FREAD, COPY, ERROR

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ehssan2
Forum Newbie
Posts: 7
Joined: Sat Sep 29, 2007 12:32 pm

FREAD, COPY, ERROR

Post 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,,
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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.
Post Reply