views:

485

answers:

3

I want to fetch the names of users on facebook. For that, I tried using FQL query. The code is,

$result = $facebook->api_client->fql_query("SELECT name FROM user WHERE uid='$user_id');

But there is some problem with this. I guess the query is not getting executed or it is returning null values. I also tried using users.getInfo as follows,

$result = $facebook->api_client->users_getInfo($user_id,'name');

But again, the same problem.

I tried to display the array as,

echo $result['name];

So, I tried both the codes as,

if(!$facebook->api_client->fql_query("SELECT name FROM user WHERE uid='$user_id')) {
   echo "Error.";
}

I have included both facebook.php and facebookapi_php5_restlib.php in my php file. Where am i going wrong?

A: 

now i can fixed this problem.. open and modify file facebookapi_php5_restlib.php and like this

  public function post_request($method, $params, $server_addr) {
    list($get, $post) = $this->finalize_params($method, $params);
    $post_string = $this->create_url_string($post);
    $get_string = $this->create_url_string($get);
    $url_with_get = $server_addr . '?' . $get_string;
    if ($this->use_curl_if_available && function_exists('curl_init')) 
    {
      $useragent = 'Facebook API PHP5 Client 1.1 (curl) ' . phpversion();
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $url_with_get);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3600);
      curl_setopt($ch, CURLOPT_TIMEOUT, 3600);
      $result = $this->curl_exec($ch);
      curl_close($ch);
    } else {

    $content_type = 'application/x-www-form-urlencoded';
      $content = $post_string;
      $result = $this->run_http_post_transaction($content_type,$content, $url_with_get);
    }
    return $result;
  }

change time out for

Anuwat
A: 

La funcion finalize_params ???

Raul
A: 

could you give me your full facebookapi_php5_restlib.php please? I really appreciate it

Raul

related questions