Re: remote file existance when protected by a .htaccess

From: Date: Thu, 21 Oct 2004 16:20:46 +0000
Subject: Re: remote file existance when protected by a .htaccess
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-200006@lists.php.net to get a copy of this message
try this function, I lifted almost all of this stuff off of the manual and the zend site function check_link($link , $referer='') { $main = array(); $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $link); curl_setopt ($ch, CURLOPT_HEADER, 1); curl_setopt ($ch, CURLOPT_NOBODY, 1); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_NETRC, 1); curl_setopt ($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // this line makes it work under https if(isset($referer)) { curl_setopt($ch, CURLOPT_REFERER, $referer); } ob_start(); curl_exec ($ch); $stuff = ob_get_contents(); ob_end_clean(); curl_close ($ch); $parts = split("n",$stuff,2); $main = split(" ",$parts[0],3); return $main; } // function check_link $url = 'your url'; $referer = 'your referer'; print_r(check_link($url , $referer));

« previous php.general (#200006) next »