【问题标题】:how to set cookies in curl using LIB_http如何使用 LIB_http 在 curl 中设置 cookie
【发布时间】:2013-02-15 18:50:04
【问题描述】:

我在抓取 manta.com 页面时一次又一次地收到 cookie 消息 消息是 数组([文件] => 哎呀。 在继续之前,请激活您的浏览器 cookie。

我正在使用这样的 cookie

curl_setopt($ch, CURLOPT_TIMEOUT, CURL_TIMEOUT);    // Timeout
curl_setopt($ch, CURLOPT_USERAGENT, WEBBOT_NAME);   // Webbot name
curl_setopt($ch, CURLOPT_URL, $target);             // Target site
curl_setopt($ch, CURLOPT_REFERER, $ref);            // Referer value
curl_setopt($ch, CURLOPT_VERBOSE, FALSE);           // Minimize logs
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);    // No certificate
curl_setopt($ch, CURLOPT_PROXY, '10.1.11.11:8080');
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);     // Follow redirects
curl_setopt($ch, CURLOPT_MAXREDIRS, 4);             // Limit redirections to four
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);     // Return in string
//curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);

【问题讨论】:

  • @balmy 不确定在一个 8 年前的低质量问题上修复一个小错字有多大用处...

标签: php cookies curl screen-scraping web-crawler


【解决方案1】:

你不能轻易地抓取 manta.com。他们有一个反机器人系统,即使您伪装您的代理,也可以停止机器人活动。我相信你仍然可以抓取它们,但这需要时间和大量的聪明才智。

【讨论】:

  • 你是对的,但这是我需要的......另一种进入侧面蝠鲼的方式
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-06-22
  • 2015-03-13
  • 2014-10-27
  • 1970-01-01
  • 1970-01-01
  • 2013-06-12
  • 2011-01-01
相关资源
最近更新 更多