I'm trying to parse another web page.
I'm using fopen() to grab the page.
The problem I'm having is the displaying of images.
when i call my php page with the web page passed in like this:
"test.php?url=http://www.pbase.com/stf2001"
it works perfectly.
but if i hardcode the variable $url within the test.php script, the page still gets parsed, but all the images come up broken.
what's the reason for this?
is this a misconfiguration of the php server?
here is the test.php script:
<?php
$COLUMNS = 3;
$FILEPATH = $url;
echo "file $FILEPATH";
$FILE = fopen($FILEPATH,'r');
if (!$FILE) {
echo "No file was found.";
} else {
echo "<table><tr>";
$img_count = 1;
while (!feof($FILE)){
$BUFFER = fgets($FILE,4096);
if (preg_match("/class=\"thumbnail\"/",$BUFFER))
{
$buffer_parts = explode(">", $BUFFER);
$buffer_parts[1] .= ' target=\"picture\"';
$newout = join(">",$buffer_parts);
echo $newout;
flush();
$mod_res = $img_count % $COLUMNS;
if ($mod_res == 0){
echo "</TR><TR>";
}
$img_count++;
}
}
echo "</tr></table>";
}
fclose($FILE);
?>