【发布时间】:2015-11-10 23:54:16
【问题描述】:
我有一个 HTML SIMPLE DOM PARSER 程序...
我的问题是:
我正在尝试获取不同页面上的产品链接。
首页的链接,收藏没问题。
当我尝试访问第二页时出现了大问题。有一个事件不改变url就启动产品,根据页面添加#/page-2 ... 3 ... 4。
问题是程序无法走到第二页。它总是在第一个,重复这个链接。
有没有办法让程序移到第二页?
这是我使用的代码:
我放了示例 url,但我使用 $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/>";
}
【问题讨论】:
-
它使用 AJAX 加载它,因此您需要弄清楚发出的请求是什么并在您的脚本中生成。
标签: javascript php jquery html simple-html-dom