At 13:08 25.03.2003, Jens Lehmann spoke out and said:
--------------------[snip]--------------------
>A thing which seemed a bit confusing to me is that if I open a 
>non-existing website (fopen('http://www.amazon.de/nonsensestuff')) I 
>always get an error message "Success". It's the same thing if I use 
>file(). The manual explains that fopen() returns false if the website 
>could not be opened, that's why I don't know why this error message 
>appears? Besides this "Success"-message is surely a very bad error 
>message. I use PHP 4.2.3.
--------------------[snip]-------------------- 

If the website doesn't exist, but the web SERVER does, it will return
something, usually a 404-message. fopen() doesn't check for HTTP result
codes, it just opens the stream and retuirns whatever gets sent (with the
single exception of omitting the headers, but without looking).

So in fact an fopen() to a non-existing page will be seen as successful by
fopen(). This is by design and afaik documented somewhere.

To actually check on the HTTP status codes you need to run your own, either
using cURL, or by doing your own stuff using fsockopen().


-- 
   >O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
    ^ http://www.vogelsinger.at/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to