Forum Moderators: coopster
$url = "test.tumblr.com";
$file_headers = @get_headers($file);
if($file_headers[0] == 'HTTP/1.1 404 Not Found') {
echo "URL Not Valid";
}
else {
echo "URL Vaild";
} $url = "notavaildurl.tumblr.com"; GET / HTTP/1.1
Host: www.tumblr.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0) Gecko/20100101 Firefox/6.0
... {et cetera}
HTTP/1.1 302 Found
Date: Mon, 12 Sep 2011 03:59:24 GMT
Server: Apache
P3P: CP="ALL ADM DEV PSAi COM OUR OTRo STP IND ONL"
Location: https://www.tumblr.com/ https://www.tumblr.com/why/_reasons
GET /why/_reasons HTTP/1.1
Host: www.tumblr.com print_r(get_headers('http://webmasterworld.tumblr.com/')); Array
(
[0] => HTTP/1.1 200 OK
[1] => P3P: CP="ALL ADM DEV PSAi COM OUR OTRo STP IND ONL"
[2] => X-Tumblr-User: webmasterworld
[3] => Link: ; rel=icon
[4] => Vary: Accept-Encoding
[5] => X-Tumblr-Usec: D=99364
[6] => Content-Type: text/html; charset=UTF-8
[7] => Content-Length: 13378
[8] => Date: Tue, 13 Sep 2011 23:33:29 GMT
[9] => Connection: close
)
print_r(get_headers('http://notavaildurl.tumblr.com/')); Array
(
[0] => HTTP/1.1 404 Not Found
[1] => P3P: CP="ALL ADM DEV PSAi COM OUR OTRo STP IND ONL"
[2] => Cache-Control: max-age=300
[3] => Vary: Accept-Encoding
[4] => X-Tumblr-Usec: D=25702
[5] => Content-Type: text/html; charset=UTF-8
[6] => Content-Length: 1870
[7] => Date: Tue, 13 Sep 2011 23:38:22 GMT
[8] => Connection: close
)