2

外部 PHP ファイルの (前処理された) コンテンツを取得しようとしています。

file_get_contents('http://www.example.org/myfile.php');

これを行うと、エラーが発生します。

警告: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo が失敗しました: nodename も servname も指定されていないか、13 行目の /Applications/XAMPP/xamppfiles/htdocs/...localfile.php で不明です

と:

警告: file_get_contents(http://www.example.org/myfile.php) [function.file-get-contents]: ストリームを開けませんでした: php_network_getaddresses: getaddrinfo に失敗しました: ノード名もサーブ名も指定されていないか、/Applications/ で不明です13行目のXAMPP/xamppfiles/htdocs/.../localfile.php

私にできることはありますか?

前もって感謝します!

編集: allow_url_fopen を「オン」に設定しています。

4

1 に答える 1

4

おそらくcURLを使用できます...

function curl($url){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    $return = curl_exec($ch);
    curl_close ($ch);
    return $return;
}


$string = curl('http://www.example.org/myfile.php'); //string with data
于 2010-09-26T18:05:14.070 に答える