我有一个 HTML SIMPLE DOM PARSER 程序...
我的问题是:
我正在尝试获取不同页面上的产品链接。
第一页的链接,收集没问题。
当我尝试访问第二页时,出现了大问题。有一个事件,在不更改 url 的情况下启动产品,根据页面添加 #/page-2 ... 3 ... 4。
问题是程序无法走到第二页。它始终位于第一个,重复此链接。
有办法让程序移动到第二页吗?
这是我使用的代码:
我放置了示例网址,但我使用 $nextLink 循环页面。
谢谢^^
$html = new simple_html_dom();
$dom = $html->load(file_get_contents(http://www.perfumeriasabina.com/es/29-perfumeria-sabina-online#/page-2));
if (!empty($dom))
{
$dom->find('a');
}
$productos = $html->find('.product_img_link');
foreach($productos as $producto)
{
$enlaces = $producto->href;
echo $enlaces . "<br/>";
}
最佳答案
在该网站上进行少量研究后,只需附加:
?p=2
到url,根据您要下载的页码,所以您的URL将如下所示:
http://www.perfumeriasabina.com/es/29-perfumeria-sabina-online?p=2
关于javascript - 让 $dom = $html->load(file_get_contents($nextLink)) 等待网站加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33641903/