How can I get the span tag value using php curl and simple html dom parser?the exact value does not show
You can use xpath selector
<?php$html = '<span class="file-count-label" ng-init="totalResultCount=304575" ng-show="totalResultCount" style="">304,575</span>';$doc = new DOMDocument;$doc->loadHTML($html);$finder = new DomXPath($doc);$classname="file-count-label";$videos = $finder->query("//*[contains(@class, '$classname')]");foreach($videos as $e){ echo $e->nodeValue;}
Output:- https://eval.in/1056186
Reference taken:- https://stackoverflow.com/a/6366390/4248328
It works for me:
include 'simple_html_dom.php';$html = str_get_html('<span class="file-count-label" ng-init="totalResultCount=304575" ng-show="totalResultCount" style="">304,575</span>');$videos=$html->find('span[class=file-count-label]');foreach($videos as $e){ echo $e->plaintext; // 304,575}