doupafu6980 2014-12-30 21:05
浏览 54

php简单的html dom脚本不接受自己的网站

With the following script: http://simplehtmldom.sourceforge.net/

The code to include my own page gives the following error:

[Tue Dec 30 21:54:47 2014] [error] [client 84.241.198.67] FastCGI: server "/var/run/php-fpm/php54/php-cgi" stderr: in xxxx/simple_html_dom.php on line 75
[Tue Dec 30 21:54:47 2014] [error] [client 84.241.198.67] FastCGI: server "/var/run/php-fpm/php54/php-cgi" stderr: PHP message: PHP Fatal error: Call to a member function find() on a non-object in xxxxx/www/design/header.php on line 46

This is the code I use. (When I use 'http://www.google.com' for example it does work. But with my own URL it keeps giving errors (not loading the page)

$html = file_get_html('website/verslagdetail/2');

// find all link
foreach($html->find('h3') as $e) 
echo $e->innertext . '<br>';

What can be the problem? I want to use this to create a nice for each page and let this code decide the title

  • 写回答

1条回答 默认 最新

  • dongzang5815 2014-12-30 21:12
    关注

    It just looks like this is a path issue. $html is non reference likely meaning that file_get_html() on the path "website/verslagdetail/2" didn't resolve to anything. You most likely need to fix that relative path or use an absolute path

    评论

报告相同问题?

悬赏问题

  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥60 许可证msc licensing软件报错显示已有相同版本软件,但是下一步显示无法读取日志目录。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加