我收到了一些链接,其中一些链接是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;
什么是你的代码?他们返回什么? –