我收到了一些鏈接,其中一些鏈接是rapidshare,一些鏈接是其他上傳主機。 如何檢查鏈接上的文件是否仍在工作?使用php檢查主機的鏈接
我試着用curl和file_get_contents。 在一些主機上curl正在工作,而其他file_get_contents正在工作,但大多數不會返回頁面源代碼,所以我無法搜索字符串「已刪除」或類似的東西。
有沒有辦法做到這一點?
編輯:這裏是新的代碼,仍然無法工作:
function curl_download($Url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
$agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch,CURLOPT_VERBOSE,false);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch,CURLOPT_SSLVERSION,3);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
$output = curl_exec($ch);
curl_close($ch);
return $output;
什麼是你的代碼?他們返回什麼? –