Harry
Harry

Reputation: 319

Facebook Graph API - get full name without using file_get_contents

I can't use 'file_get_contents' because my host won't allow php 'open_url_fopen'.

Is there any way of getting the full name of a Facebook user, from their Facebook ID, using PHP without file_get_contents?

(extract the full name from a link like: graph.facebook.com/zuck?ref=ts)

Thanks.

Upvotes: 0

Views: 1844

Answers (1)

Dhiraj
Dhiraj

Reputation: 33618

Why don't you use cURL

$url = 'http://graph.facebook.com/zuck?fields=name';

$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_URL,$url);
$result = curl_exec($ch);
curl_close($ch);
var_dump($result);

Upvotes: 2

Related Questions