Im having a bit of trouble opening a file off the web, grabbing a line from that file and inserting it into a local file. Here is what i have, the problem is that $printfile will not insert into the new file. If i replace print file with say "tester", in the local file, it will show up. Very clueless why this is not working. Here is my code:
<?
// Open file off web
if (!($readfile = fopen("http://www.ny.frb.org/pihome/statistics/forex12.shtml", "r")))
{
print("Could not open");
exit;
}
while(!feof($readfile))
{
$printfile = fgetss($readfile, 255);
$printfile = strstr($printfile, "Canada");
echo"<PRE>$printfile</PRE>";
// Insert info into local file
$myFile = fopen("data.php3", "w");
fputs($myFile, $printfile);
fclose($myFile);
}
fclose($readfile);
?>