Raex Posted August 26, 2014 Share Posted August 26, 2014 Hi, I have a php code that could extract the categories and display them. However, I still can't extract the numbers that goes along with it too(without the bracket). This is my code: <?php $grep = new DoMDocument(); @$grep->loadHTMLFile("http://www.lelong.com.my/Auc/List/BrowseAll.asp"); $finder = new DomXPath($grep); $class = "CatLevel1"; $nodes = $finder->query("//*[contains(@class, '$class')]"); foreach ($nodes as $node) { $span = $node->childNodes; echo $span->item(0)->nodeValue."<br>"; } ?> This is my desired output: Arts, Antiques & Collectibles : 9768 B2B & Industrial Products : 2342 Baby : 3453 etc... Any help is appreciated. Thanks! Link to comment https://forums.phpfreaks.com/topic/290653-website-scaping-using-domdocument/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.