Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8558811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:53:49+00:00 2026-06-11T15:53:49+00:00

Here is a basic example of how simple_html_dom works in a standalone php file.

  • 0

Here is a basic example of how simple_html_dom works in a standalone php file.

test.php:

include ('simple_html_dom.php');

$url = "http://www.google.com";
$html = new simple_html_dom();
$html->load_file($url);

print $html;

If I execute it with the command: php test.php

It dumps correctly the html of the website (in this example, google.com)

Now let’s take a look at a basic example of code using a Symfony task:

class parserBasic extends sfBaseTask {
  public function configure()
  {
    $this->namespace = 'parser';
    $this->name      = 'basic';
  }

  public function execute($arguments = array(), $options = array())
  {
    $url = "http://www.google.com";
    $html = new simple_html_dom();
    $html->load_file($url);
    print $html;
  }
}

This file it’s located under: <appname>/lib/task

I don’t need to include the library in the file because being under the lib/task folder, it gets automatically loaded.

I execute the task using this command: php symfony parser:basic

And I get the following error message:

PHP Fatal error:  
Call to a member function innertext() on a non-object in
/home/<username>/<appname>/lib/task/simple_html_dom.php on line 1688

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:53:50+00:00Added an answer on June 11, 2026 at 3:53 pm

    The problem comes from Symfony.

    In fact, if an error occur when loading the file with simple_html_dom, it won’t say anything but returning false.

    For example, if you perform this in your task:

    $url = "http://www.google.com";
    $html = new simple_html_dom();
    $res = $html->load_file($url);
    if (false === $res)
    {
        throw new Exception("load_file failed.");
    }
    print $html;
    

    You will get an exception. If you tweak simple_html_dom to display en error when loading a file, around line 1085:

    // load html from file
    function load_file()
    {
        $args = func_get_args();
        $this->load(call_user_func_array('file_get_contents', $args), true);
        // Throw an error if we can't properly load the dom.
    
        if (($error=error_get_last())!==null) {
            // I added this line to see any errors
            var_dump($error);
    
            $this->clear();
            return false;
        }
    }
    

    You will see:

    array(4) {
      ["type"]=>
      int(8)
      ["message"]=>
      string(79) "ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush"
      ["file"]=>
      string(62) "/home/.../symfony.1.4/lib/command/sfCommandApplication.class.php"
      ["line"]=>
      int(541)
    }
    

    I usually got this error (which is, in fact, a notice) when using task. The problem is here, in sfCommandApplication, with ob_end_flush:

    /**
     * Fixes php behavior if using cgi php.
     *
     * @see http://www.sitepoint.com/article/php-command-line-1/3
     */
    protected function fixCgi()
    {
      // handle output buffering
      @ob_end_flush();
      ob_implicit_flush(true);
    

    To fix that, I comment the line with @ob_end_flush();. And every thing goes fine. I know, it’s an ugly fix, but it works. An other way to fix that, is to disable notice from PHP (in php.ini), like :

    // Report all errors except E_NOTICE
    error_reporting = E_ALL ^ E_NOTICE
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my attempt so far http://thezoo.com/test/ At http://tooltipsy.com/samples.html his 7th example down the
I'm trying to follow the basic cometd example here: http://dojotoolkit.org/reference-guide/1.7/dojox/cometd.html It's using the old
We have a Union Query. Here's a basic (similar) example: SELECT a.Name, b.Info FROM
To provide as much information as I can, here's a very basic example of
Here I am doing a basic trigger example but jquery is unable to execute
Here is an example of what I would do in Visual Basic: Public Class
I am missing something embarrassingly basic here in my Merge Sort implementation: # include
I´m looking at example 6.7 from http://publications.gbdirect.co.uk/c_book/chapter6/structures.html (Pasted here for convenience) struct list_ele *
I've got a basic PHP contact form and have it process.php file that checks
I'm trying to comprehend ontology basics. Here's an example: car (class) 2009 VW CC

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.