douxiong3234 2013-03-15 04:04
浏览 92
已采纳

简单的html dom无法正常工作,显示错误[关闭]

I am using simple html dom to parse html page..... This is my code..

include('simple_html_dom.php');


$html = file_get_html($my_url);


foreach($html->find('div') as $ul) {
     echo $ul;
   }

And i have also tried many other ways . Still i get this error. Error:

 Call to a member function find() on a non-object

I have tried out with other tags as well...

  $html->find('a');
  $html->find('h3');
  //But still same above error

Can anyone plz help me out wit the error..Thanks in advance

  • 写回答

2条回答 默认 最新

  • dpdbu24262 2013-03-15 04:48
    关注

    Well i found out the solution, The solution is:-

    The latest version of simple_html_dom has got bugs in it.... So dont use simplehtmldom_1_5 file from sourceforge... Better use simplehtmldom_1_10 from sourceforge it works fine.

    Bugs in simplehtmldom_1_5:-

    Url of any site doesnt work here. You can give url of html file , but site url doesnt work It is not identifying ur object $html after reading the url....

    Hope it helps people facing similar problem....

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?