0
我试图建立使用的Symfony 2的DOM履带黑客新闻刮刀过滤[1]遇到问题与XPath
当我尝试用镀铬插件[2],它的工作原理的XPath。但是,当我尝试在我刮我不断收到The current node list is empty.
这里是我的刮板代码:
$crawler1 = $client1->request('GET','https://news.ycombinator.com/item?id=8296437');
$hnpost->selftext = $crawler1->filterXPath('/html/body/center/table/tbody/tr[3]/td/table[1]/tbody/tr[4]/td[2]')->text();
[1] http://api.symfony.com/2.0/Symfony/Component/DomCrawler/Crawler.html#method_filter [2] https://chrome.google.com/webstore/detail/xpath-helper/hgimnogjllphhhkhlmebbmlgjoejdpjl?hl=en-US
可能的重复[为什么我的XPath查询(抓取HTML表)只能在Firebug中工作,但不是我正在开发的应用程序?](http://stackoverflow.com/questions/18241029/why-does-my -xpath查询刮-HTML的表只,工作在萤火,但并非对) – 2014-10-12 17:41:31