Page 1 of 1

FREAD, COPY, ERROR

Posted: Sat Sep 29, 2007 12:42 pm
by ehssan2
hi everyone
i hope some one can answer me,
i have writen a code to work as a proxy and get the data and put the data in a varialble for my future use.

ok
here is the code

Code: Select all

if (isset($_POST['Submit'])){
$url=$_POST['ads'];
$contents = '';
while (!feof($url)) {
  $contents .= fread($url, 8192);
}
fclose($url);
}
this script works perfect and does what i want.
BUT (here comes the problem)
it only works if the page HTTP status is 200/OK , i need this to work when the HTTP is 500 (internal error).
i want to see the error that the page gives when submiting a bad url, ..

please help me solve my problem,,

Posted: Sat Sep 29, 2007 3:08 pm
by volka
You might be interested in http://de2.php.net/http and/or http://de2.php.net/curl


p.s.: I don't believe that's your real code. At least the fopen() is missing.