phpspider icon indicating copy to clipboard operation
phpspider copied to clipboard

请问如何使用多个代理ip采集数据?

Open czly opened this issue 7 years ago • 1 comments

请问如何使用多个代理ip采集数据? 拿豆瓣读书那个举例,现在已经不能采集数据了,经常显示sorry,这个怎么破?

czly avatar May 13 '17 03:05 czly

两种办法,一是申请阿布云的,他哪里是一个接口,每次都换代理IP,一个是自己网上采集一下代理ip,然后用 $spider->on_start = function($phpspider) { $proxies = array( 'http' => 'http://user:pass@host:port', 'https' => 'http://user:pass@host:port', ); requests::set_proxies($proxies); };

owner888 avatar May 16 '17 03:05 owner888