我的 Scrapes 在 100 条记录时终止一次,然后是 66、50、50!我可以如何减慢我的抓取速度?

My Scrapes terminated once at 100 records, then 66, 50, 50! Can I slow down my Scraping some how?

我是屏幕抓取的新手,想知道是否有人可以告诉我如何减慢抓取过程,以便我的查询更像人而不是明显的机器人。

这是我的 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); 

你可以做到这一点

sleep(rand(5, 15)); // sleep between 5-15 seconds