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