Jump to content

Recommended Posts

Hi there (first post),

I'm trying to learn how to manipulate html with PHP and DOM. I'm fairly new to this.

 

The problem I seem to be having seems to be server related. I've spoken to the support people and they say they don't support simple html DOM and so when I try to call-

 

file_get_html()

 

fatal errors occur.

 

I wonder if someone could point me in the right direction here- are there any available hosts that will support simple html DOM?

 

Any advice appreciated. If you need more info let me know.

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/226119-html-dom/
Share on other sites

Quite right, ok here's the error and code-

 

Fatal error: Call to a member function find() on a non-object in /home/histo760/public_html/findlinks.php on line 10

 

<?php

// Create DOM from URL or file

$html = file_get_html('http://www.google.com/');

 

// Find all links

foreach($html->find('a') as $element)

      echo $element->href . '<br>';

?>

 

Cheers

Link to comment
https://forums.phpfreaks.com/topic/226119-html-dom/#findComment-1167308
Share on other sites

sorry, i have never used simple html dom. but apparently you download it and include() it. it doesn't need to be compiled within php, so the host you use shouldn't matter.

 

http://sourceforge.net/projects/simplehtmldom/files/

 

i suggest that you download it, then read the manual and follow the examples included with the download.

Link to comment
https://forums.phpfreaks.com/topic/226119-html-dom/#findComment-1167317
Share on other sites

You download this as BlueSkyIS mentioned, you can even read the tutorials and examples.

http://sourceforge.net/projects/simplehtmldom/files/

 

Upload the new simplehtmldom folder to your website.

 

Every time you use simplehtml dom code you must include the file simple_html_dom.php once before you call any dom code.

 

You can place simple_html_dom.php in the same folder as your script is, or can refer to it from the new simplehtmldom folder, that is up to you.

Link to comment
https://forums.phpfreaks.com/topic/226119-html-dom/#findComment-1167389
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.