file_get_html displays Fatal Error Call to undefined function

You are calling class does not belong to php.

Download simple_html_dom class here and use the methods included as you like it. It is really great especially when you are working with Emails-newsletter:

include_once('simple_html_dom.php');
$html = file_get_html('http://www.google.co.in');

are you sure you have downloaded and included php simple html dom parser ?


As everyone have told you, you are seeing this error because you obviously didn't downloaded and included simple_html_dom class after you just copy pasted that third party code, Now you have two options, option one is what all other developers have provided in their answers along with mine,

However my friend,

Option two is to not use that third party php class at all! and use the php developer's default class to perform same task, and that class is always loaded with php, so there is also efficiency in using this method along with originality plus security!

Instead of file_get_html which not a function defined by php developers use-

$doc = new DOMDocument(); $doc->loadHTMLFile("filename.html"); echo $doc->saveHTML(); that's indeed defined by them. Check it on php.net/manual(Original php manual by its devs)

This puts the HTML into a DOM object which can be parsed by individual tags, attributes, etc.. Here is an example of getting all the 'href' attributes and corresponding node values out of the 'a' tag. Very cool....

$tags = $doc->getElementsByTagName('a');

foreach ($tags as $tag) {
       echo $tag->getAttribute('href').' | '.$tag->nodeValue."\n";
}

P.S. : PLEASE UPVOTE IF YOU LIKED MY ANSWER WILL HELP MY REPUTATION ON STACKOVERFLOW, THIS PEOPLES THINK I'M NOOB!

Tags:

Php