It sounds like you don't care about the content of the webpage, you just want to see if it exists. Here's how I will do it in PHP - I can stop PHP from capturing memory with the contents of the page.
/* * Returns false if the page could not be retrieved (ie., no 2xx or 3xx HTTP * status code). On success, if $includeContents = false (default), then we * return true - if it true, then we return file_get_contents() result (a * string of page content). */ function getURL($url, $includeContents = false) { if($includeContents) return @file_get_contents($url); return (@file_get_contents($url, null, null, 0, 0) !== false); }
For less verbosity, replace the above function contents with this.
return ($includeContents) ? @file_get_contents($url) : (@file_get_contents($url, null, null, 0, 0) !== false) ;
See http://www.php.net/file_get_contents for more information on how to specify HTTP headers using a stream context.
Greetings.
Sam bisbee
source share