我对屏幕抓取非常新,并且想知道是否有人可以告诉我如何减慢抓取过程,以便我的查询往往更像人,而不是一个明显的机器人。
这是我对curl_setopt的所作所为:
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 180);
curl_setopt($ch, CURLOPT_TIMEOUT, 300);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt ($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($this->ch, CURLOPT_URL, $this->url);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->ch, CURLOPT_BINARYTRANSFER, $this->binary);
答案 0 :(得分:0)
你可以这样做
sleep(rand(5, 15)); // sleep between 5-15 seconds