【发布时间】:2011-12-19 00:28:12
【问题描述】:
我有一些链接,一些在 rapidshare 上,一些在其他上传主机上。 如何检查链接上的文件是否仍然有效?
我尝试使用 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;
【问题讨论】:
-
你的代码是什么?他们返回什么?