stackoverflow 上已经有类似的问题,但他们的解决方案都没有为我工作。我正在尝试使用 cURL 在 LoveIt.com 上获取一个页面,但它返回一个 404 错误,而 url 在浏览器中工作正常:
$url = 'http://loveit.com/loves/P0D1jlFaIOzzZfZqj_bY3KV';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt ($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_REFERER,'http://loveit.com/');
这是我收到的标题:
数组 ( [url] => http://loveit.com/loves/P0D1jlFaIOzzZfZqj_bY3KV [content_type] => text/html; charset=utf-8 [http_code] => 404 [header_size] => 667 [request_size] => 172 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.320466 [namelookup_time] => 0.000326 [connect_time] => 0.119046 [pretransfer_time] => 0.119089 [size_upload] => 0 [ size_download] => 499 [speed_download] => 1557 [speed_upload] => 0 [download_content_length] => 499 [upload_content_length] => 0 [starttransfer_time] => 0.320438 [redirect_time] => 0 [certinfo] => 数组 () [ primary_ip] => --- [primary_port] => 80 [local_ip] => --- [local_port] => 53837 [redirect_url] => )
我读到一些网站对这种脚本有保护;我确实测试了一些建议的解决方案,但没有一个对我有用(CURLOPT_USERAGENT,CURLOPT_REFERER ...)
对这里发生的事情有任何想法吗?
我想备份我的 LoveIt 帐户,这就是我做这个的原因(没有导出功能,也没有来自 LoveIt.com 的关于网站健康状况的回复)