I am trying to read in a particular page to a variable. How do you handle if the page is a 404 and then redirects to a custom error page? Am I supposed to use fsockopen and read headers or ?? Ideally I need to pull the end-result page to search for a string in it.
Here's the code
$handle = fopen("http://www.amazon.com/exec/obidos/ISBN=12345678", "rb");
$contents = "";
do {
$data = fread($handle, 8192);
if (strlen($data)==0)
break;
$contents .= $data;
} while(true);
fclose ($handle);
Thanks guys
.................................... Mike Dunlop AWN, Inc. // www.awn.com [ e ] [EMAIL PROTECTED] [ p ] 323.606.4237
You can use PEAR's HTTP_Request, which will do redirects for you (and lots of other stuff ;-).
http://pear.php.net/package/HTTP_Request
-- paperCrane <Justin Patrin>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php