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条)

报告相同问题?

悬赏问题

  • ¥20 校园二手交易小程序搭建
  • ¥15 请问在ubuntu用conda创建环境报错怎么能解决
  • ¥15 STM32CubeMX/proteus按键控制指示灯颜色切换
  • ¥20 python,计算区位熵和扩张指数
  • ¥15 Python环境配置
  • ¥15 大四学生的困惑,有偿提问!
  • ¥15 解决页面无法编入索引:被“noindex”标签排除的问题?
  • ¥15 arduino测量电阻
  • ¥15 快手uid转快手号谁能解决 需要开发
  • ¥15 iis部署Django时css不生效,来个真人,ai不好使