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

  • Home
  • SEARCH
  • 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 8117879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:19:17+00:00 2026-06-06T04:19:17+00:00

While including the simple HTML DOM library, I get the warnings: Warning: file_get_contents() [function.file-get-contents]:

  • 0

While including the simple HTML DOM library, I get the warnings:

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\xampp\htdocs\simple_html_dom.php on line 70

Warning: file_get_contents(http://www.google.com/) [function.file-get-contents]: failed to open stream: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\xampp\htdocs\simple_html_dom.php on line 70

The line 70 in simple_html_dom.php file(downloaded from http://sourceforge.net/projects/simplehtmldom/files/latest/download) is

  $contents = file_get_contents($url, $use_include_path, $context, $offset);

Also 1 error:

Fatal error: Call to a member function find() on a non-object in C:\xampp\htdocs\domdoc2.php on line 15

where line 15 of the code(below) is

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

The web page i was referring in my code below is google.com
Code follows:

     <?php

include('simple_html_dom.php');
$html = new simple_html_dom();  
$html = file_get_html('http://www.google.com/');
// Find all images 
foreach($html->find('img') as $element) 
       echo $element->src . '<br>';

// Find all links 
foreach($html->find('a') as $element) 
       echo $element->href . '<br>';
?>

What am I doing wrong??

  • 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-06T04:19:19+00:00Added an answer on June 6, 2026 at 4:19 am

    This is because your host was unable to resolve DNS, this happens when simplehtmldom uses file_get_contents instead of curl.
    PHP Simple HTML DOM Parser is a great HTML parsing PHP class BUT it is slow since it uses
    file_get_contents (which is disabled on almost all configurations) instead of cURL (4-5 times faster and with lots of options, almost every server has it).

    Only file_get_contents is replaced so you can safely overwrite previous version and everything will work as before, only faster

    Link to source code:
    http://webarto.com/static/download/simple_html_dom.rar

    //output should be
    
    /intl/en_ALL/images/srpr/logo1w.png
    http://www.google.com/webhp?hl=en&tab=ww
    http://www.google.com/imghp?hl=en&tab=wi
    http://maps.google.com/maps?hl=en&tab=wl
    https://play.google.com/?hl=en&tab=w8
    http://www.youtube.com/?tab=w1
    http://news.google.com/nwshp?hl=en&tab=wn
    https://mail.google.com/mail/?tab=wm
    https://docs.google.com/?tab=wo
    http://www.google.com/intl/en/options/
    https://www.google.com/calendar?tab=wc
    http://translate.google.com/?hl=en&tab=wT
    http://www.google.com/mobile/?tab=wD
    http://books.google.com/bkshp?hl=en&tab=wp
    https://www.google.com/offers/home?utm_source=xsell&utm_medium=products&utm_campaign=sandbar&tab=wG#!details
    https://wallet.google.com/manage/?tab=wa
    http://www.google.com/shopping?hl=en&tab=wf
    http://www.blogger.com/?tab=wj
    http://www.google.com/reader/?hl=en&tab=wy
    http://www.google.com/finance?tab=we
    http://picasaweb.google.com/home?hl=en&tab=wq
    http://video.google.com/?hl=en&tab=wv
    http://www.google.com/intl/en/options/
    https://accounts.google.com/ServiceLogin?hl=en&continue=http://www.google.com/
    http://www.google.com/preferences?hl=en
    /preferences?hl=en
    /url?sa=p&pref=ig&pval=3&q=http://www.google.com/ig%3Fhl%3Den%26source%3Diglk&usg=AFQjCNFA18XPfgb7dKnXfKz7x7g1GDH1tg
    http://www.google.com/history/optout?hl=en
    /advanced_search?hl=en
    /language_tools?hl=en
    /intl/en/ads/
    /services/
    https://plus.google.com/116899029375914044550
    /intl/en/about.html
    /intl/en/policies/
    

    However if you are completely new to HTML parsing in PHP Please Consider reading : How do you parse and process HTML/XML in PHP?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to produce a simple, static HTML file, that has one or more
I am a newbie, writing a simple program and while there are no warnings/errors
Is including a application package prefix while defining a custom action string is convention
when including libraries c, the line does not end with a semicolon, while other
While making some final tests of a class-library that I'm writing for Windows Mobile
While trying to implement an MVC file upload example on Scott Hanselman's blog. I
I'm using the mPDF library to generate PDF docs directly from HTML output. The
I have gone over the entire file including validating and sniffing out missing or
I seem to have a problem with my very simple implementation of a file
I have a php function that brings in a simple arraycollection (called QuestionSeries) to

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.