Page 1 of 1

Posted: Sat Aug 07, 2004 12:35 pm
by feyd

Code: Select all

<?php

function getHeader($url)
{
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, 		$url);
	curl_setopt($ch, CURLOPT_HEADER, 	1);
	curl_setopt($ch, CURLOPT_TIMEOUT,	2);
	curl_setopt($ch, CURLOPT_NOBODY,	1);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
	
	return curl_exec($ch);
}

echo getHeader('http://forums.devnetwork.net');

?>
outputs

Code: Select all

HTTP/1.1 200 OK
Date: Sat, 07 Aug 2004 17:32:24 GMT
Server: Apache/1.3.31 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.8 FrontPage/5.0.2.2634a mod_ssl/2.8.18 OpenSSL/0.9.7a
X-Powered-By: PHP/4.3.8
Set-Cookie: phpbb2mysql_data=s%3A0%3A%22%22%3B; expires=Sun, 07-Aug-05 17:32:24 GMT; path=/; domain=devnetwork.net
Set-Cookie: phpbb2mysql_sid=61b110b6461ddb7e728c7d4f692b1da6; path=/; domain=devnetwork.net
Cache-Control: private, pre-check=0, post-check=0, max-age=0
Expires: Sat, 07 Aug 2004 17:32:24 GMT
Last-Modified: Sat, 07 Aug 2004 17:32:24 GMT
Content-Type: text/html
You want the success codes: HTTP/1.X 2XX, HTTP/1.X 3XX

300's are redirections.. so you may need to look where they want to send you.. :)

Posted: Sat Aug 07, 2004 12:36 pm
by hawleyjr
Feyd you rock. Thanks.