chupacabrot Posted January 23, 2014 Share Posted January 23, 2014 i am trying to extract all the anchor texts that have the _blank attribute but for some reason it won't work as i expected (shows a blank screen) - <?php require('simple_html_dom.php'); libxml_use_internal_errors( true); $url = 'http://www.siteforexample.com/example.html'; $html = file_get_html($url); foreach(($html->find('a[_blank]')) as $clz) echo $clz->innertext . '<br>'; ?> Link to comment https://forums.phpfreaks.com/topic/285608-simple-html-dom/ Share on other sites More sharing options...
Mace Posted January 23, 2014 Share Posted January 23, 2014 the attribute with the value _blank is target so maybe try a[target=_blank]. The page might also be blank because there is a php error. Try setting your error reporting on E_ALL. Link to comment https://forums.phpfreaks.com/topic/285608-simple-html-dom/#findComment-1466260 Share on other sites More sharing options...
chupacabrot Posted January 23, 2014 Author Share Posted January 23, 2014 thanks! that worked perfectly! Link to comment https://forums.phpfreaks.com/topic/285608-simple-html-dom/#findComment-1466274 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.