i have a var assigned which returns text like this below var MyDoc
alert(my doc);

<script>
document.domain='coopelrecreo.com';
weatherStations=new Array();
var t=new Array();
t['ageh']=0;
t['agem']=15;
t['ages']=2;
t['type']="ICAO";
t['id']="SVVA";
t['lat']="10.17000008";
t['lon']="-67.93000031";
t['adm1']="Valencia";
t['adm2']="";
t['country']="VN";
t['dateutc']="2008-05-27 10:00:00";
t['winddir']="0";
t['windspeedmph']="-9999.0";
t['humidity']="N/A";
t['tempf']="-9999";
t['rainin']="-9999.00";
t['baromin']="-9999";
t['dewptf']="-9999";
t['weather']="Unknown";
t['clouds']="-999";
t['flightrule']="VFR";
t['visibilitysm']="-9999.0";
t['windgustmph']="-9999.0";
t['snowin']="-9999.00";
t['name']="Valencia";
t['elev']="1414";
t['windchillf']="999.9";
t['heatindexf']="-9999";
t['maxtemp']="37.0";
t['mintemp']="37.0";
t['maxdewpoint']="37.0";
t['mindewpoint']="37.0";
t['maxpressure']="0.08";
t['minpressure']="0.08";
t['maxwindspeed']="1.7";
t['maxwindgust']="1.7";
t['maxrain']="1.10";
t['dailyrainin']="0.00";
t['dailyrain_2day']="0.00";
t['maxheatindex']="37.0";
t['minwindchill']="37.0";
weatherStations[0]=t;
var t=new Array();
t['ageh']=0;
t['agem']=5;
t['ages']=20;
t['type']="ICAO";
t['id']="SVBM";
t['lat']="10.06999969";
t['lon']="-69.31999969";
t['adm1']="Barquisimeto";
t['adm2']="";
t['country']="VN";
t['dateutc']="2008-05-27 10:00:00";
t['winddir']="110";
t['windspeedmph']="6.9";
t['humidity']="94";
t['tempf']="64.4";
t['rainin']="-9999.00";
t['baromin']="29.98";
t['dewptf']="62.6";
t['weather']="Overcast";
t['clouds']="OVC";
t['flightrule']="IFR";
t['visibilitysm']="5.0";
t['windgustmph']="-9999.0";
t['snowin']="-9999.00";
t['name']="Barquisimeto";
t['elev']="2014";
t['windchillf']="-999";
t['heatindexf']="-9999";
t['maxtemp']="64.4";
t['mintemp']="64.4";

i want to write this war to a page to be read as htm into an iframe to access the values how can be done so if i do it directly fails this is the php that i use errorlog t-string

<?php

$url = $_GET['url'];
$filename = $_GET['file'];


$line='<html><head><title>Datos</title></head><body><script language="javascript">'+ $url;
$line = str_replace('weatherStations=new Array();','weatherStations=new Array();',$line);//to replace parto the var

$line = str_replace('MapCallback(weatherStations);','parent.weatherStations=weatherStations;parent.mapApp.Ma pCallbackW(weatherStations);</script></body></html>',$line);
echo $line
$gestor = fopen($filename, 'w+')
fwrite($gestor, $line)
fclose($gestor);


?>

thsnks in advance