parsing - Parse output using PHP Simple HTML DOM parser -
i using library (php simple html dom parser) parse link, here's code:
$htmlurl = 'http://trailers.apple.com/trailers/independent/thelook/includes/playlists/web.inc'; $html = file_get_html($htmlurl); when print with:
print_r($html . "\n"); outputs me (html tree):
<h2> <span class="dropdown-handle" id="trailers-handle"> <span id='single-trailer-info'>info</span> <span class='button'> ... then want find element withe class (dropdown-list):
$divlist = $html->find('.dropdown-list'); // tried find('.dropdown-list', 0); then print with:
print_r($divlist); outputs me (array):
simple_html_dom_node object ( [nodetype] => 1 [tag] => div [attr] => array ( [class] => dropdown-list ) [children] => array ... and takes forever parsing!
am doing wrong? links have output (array) instead of output (html tree).
thanks :)
try clear or close before print_r (sorry forget which, try 1 , other).
$html->clear(); $html->close(); if doesn't work, , know object "find"ing selector type, should grab of first. search through them, makes go quicker if able that. if it's <select> find of first, run find on those, or don't use find , parse them using foreach , strpos.
if doesn't work, try fetching pages first wget, , parsing them w/ html simple dom once have saved them server.
Comments
Post a Comment