php_network_getaddresses: getaddrinfo failed error while trying to create a facebook app
I am trying to create a small facebook application. In my php file, I have written code to just display my name and to get my friend's list. This is my code:
<?php
echo "<p>Hello, <fb:name uid=\"$user_id\" useyou=\"false\"></fb:name>!</p>";
echo "<p>Friends:";
$friends = $facebook->api_client->friends_get();
$friends = array_slice($friends, 0, 25);
foreach ($friends as $friend) {
echo "<br>$friend";
}
echo "</p>";
?>
This is the output I get:
Hello, Angeline Aarthi!
Friends:
Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo failed:
No such host is known. in C:\Documents and Settings\256148\My Documents\ide\xampplite\htdocs\facebookApp\facebookapi_php5_restlib.php on line 1755
Warning: fopen(http://api.facebook.com/restserver.php) [function.fopen]:
failed to open stream: php_network_getaddresses: getaddrinfo failed:
No such host is known. in C:\Documents and Settings\256148\My Documents\ide\xampplite\htdocs\facebookApp\facebookapi_php5_restlib.php on line 1755
Warning: array_slice() expects parameter 1 to be array, string given in C:\Documents and Settings\256148\My Documents\ide\xampplite\htdocs\facebookApp\index.php on line 29
Warning: Invalid argument supplied for foreach() in C:\Document开发者_如何学运维s and Settings\256148\My Documents\ide\xampplite\htdocs\facebookApp\index.php on line 30
Please someone help me resolve my errors.
You have to set allow_url_fopen
flag to 1
in your php.ini file
In your C-Panel there is an option to use Hotlink protection, i think currently it's in enable, you need to disable this to work external link access via.,fopen() and file_get_contents() etc.
I think this may help you to resolve your problem.
精彩评论