シンプルな HTML DOM ライブラリをインクルードしているときに、次の警告が表示されます。
警告: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo に失敗しました: そのようなホストは不明です。C:\xampp\htdocs\simple_html_dom.php の 70 行目
警告: file_get_contents(http://www.google.com/) [function.file-get-contents]: ストリームを開けませんでした: php_network_getaddresses: getaddrinfo に失敗しました: そのようなホストは不明です。C:\xampp\htdocs\simple_html_dom.php の 70 行目
simple_html_dom.php ファイル ( http://sourceforge.net/projects/simplehtmldom/files/latest/downloadからダウンロード) の 70 行目は
$contents = file_get_contents($url, $use_include_path, $context, $offset);
また、1エラー:
致命的なエラー: 15 行目の C:\xampp\htdocs\domdoc2.php の非オブジェクトに対するメンバー関数 find() の呼び出し
コードの 15 行目 (以下) は
foreach($html->find('img') as $element)
以下のコードで参照していた Web ページは google.com コードは次のとおりです。
<?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>';
?>
私は何を間違っていますか??