dom - PHP : Ganon get html of a block -
i working ganon dom parser html parsing , trying content div block reason returned object not working, below code , using :
<?php set_time_limit(0); #include dom parser lib. require_once('ganon.php'); $html = file_get_dom('http://jlc.watchprosite.com/?show=forumpost&fi=2&pi=1818820&ti=279373&msid=&s='); print_r($html("div[id='sidebar']")->childcount()); ?> this gives
fatal error: call member function childcount() on non-object in d:\xampp\htdocs\govberg\test.php on line 7 when print_r($html) printing large object.
anyboby able point out whats going wrong..
try like,
if ($html("div[id='sidebar']",0)){ // or use # if ($html("div#sidebar",0)){ echo 'total children '.$html("div[id='sidebar']",0)->childcount(); }
Comments
Post a Comment