views:

17

answers:

1

Hi, 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:\Documents and Settings\256148\My Documents\ide\xampplite\htdocs\facebookApp\index.php on line 30

Please someone help me resolve my errors.

A: 

You have to set allow_url_fopen flag to 1 in your php.ini file

rubayeet
Still it doesn't work :-(
Angeline Aarthi

related questions