At 07:55 03.06.2003, Kjell Hansen said:
--------------------[snip]--------------------
>Thanx Chris,
>this is exactly what I do. And I get
>"Warning: fopen(http://www.whatever.com/index.html) [function.fopen]: failed
>to create stream: HTTP request failed! HTTP/1.1 404 Object Not Found"
>
>I don't want to get the warning. I know I can switch it off but there are
>other warnings I would like to see.
>
>Somehow I just want to check for "HTTP/1.1 404 Object Not Found" and if
>found show it as a broken link.
--------------------[snip]-------------------- 

You can't do it that way. If a web page is missing, the webserver will
transmit the error page for code 404. You cannot rely that this will always
the string you're looking for, and you cannot be sure that a regular page a
link points to will _not_ contain this string.

Just to omit the warning, you may use the silent-error notation
    @fopen($url, 'r');
but this will always work unless the host portion of the URL cannot be
resolved.

You need to employ a method where you receive the MIME headers additional
to the page body. Have a look at cURL
(http://www.php.net/manual/en/ref.curl.php) how to do this.

HTH,

-- 
   >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