fopen >> custom 404 issue
| From: | Mike D | Date: | Thu, 11 Dec 2003 00:48:47 +0000 |
| Subject: | fopen >> custom 404 issue | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-172413@lists.php.net to get a copy of this message | ||
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 ] webmaster@awn.com
[ p ] 323.606.4237