#137 Fatal error: Call to a member function find() on a non-object


(i found your script after asking a question on Stackoverflow today. you can see my original question from there:

I want to load a part of a file that contains some DIV sections named with "id=a1" , "id=a2" ...

the code i have used is:

//$html->find('div', 1)->class = 'bar';

$ngm_str=$html->find('div[id=a1]', 0);

echo $ngm_str;

The "PHP Simple HTML DOM Parser" is so nice and work for me.
But it just work for small files. (i've test for files under 100-500KB)
Now i want to use "PHP Simple HTML DOM Parser" for big files. (like 1MB-10MB)

i got this error:
Fatal error: Call to a member function find() on a non-object in /public_html/load.php on line 9
(line 9 is: $ngm_str=$html->find('div[id=a1]', 0);)

Please Help me to wolve this problem.


  • Sebastian Fuentes

    simple_html_dom.php line 65
    define('MAX_FILE_SIZE', xxx);


  • hlcb

    hlcb - 2014-05-28

    Suggestion for improvement. Change code that allows the user to set the maximum size before including simple_html_dom.php file.

    With the new code, the user can set their own maximum file size allowed, if it is not set, the value will default to 600000.

    define('MAX_FILE_SIZE', 600000); // Old Code
    defined( 'MAX_FILE_SIZE' ) || define( 'MAX_FILE_SIZE', 600000 ); // New Code

    The same goes for other three constants in which the user can set before including the file.

    defined( 'DEFAULT_TARGET_CHARSET' ) || define( 'DEFAULT_TARGET_CHARSET', 'UTF-8' );
    defined( 'DEFAULT_BR_TEXT' ) || define( 'DEFAULT_BR_TEXT', "\x0d\x0a" );
    defined( 'DEFAULT_SPAN_TEXT' ) || define( 'DEFAULT_SPAN_TEXT', "\x20" );

    Is there any place where I can give suggestions on the direct development of the file? Improvements, tips, discuss ideas, adding smart features and functions help and stuff?

    Simple_html_dom I use often, and so I decided to help a bit in development, even a little help is a fantastic class that deserves some attention of its members to improve further.

    Last edit: hlcb 2014-05-28

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks