php curl停止让我得到结果

时间:2015-11-30 15:49:03

标签: php curl

有些人知道为什么卷曲停止在12页后给我结果?

即时通讯使用简单的html dom,到处寻找答案

<pre><code>

include 'simple_html_dom.php';
for ($i=1;$i<20;$i++)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.aliexpress.com/wholesale?site=glo&g=y&SearchText=baby+romper&page=$i&initiative_id=SB_20151130033753&shipCountry=IL&needQuery=n");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 100000);
curl_setopt($ch, CURLOPT_REFERER, "http://www.test.com");
$html = str_get_html(curl_exec($ch));


foreach($html->find('a[class=product]') as $a)
{

    echo  $a->attr['href']."<br/>";

}
echo "<h1>$i</h1>";
}
curl_close($ch);
</code></pre>

0 个答案:

没有答案