Skip to content

Instantly share code, notes, and snippets.

@ScottPhillips
Created January 4, 2012 18:11
Show Gist options
  • Save ScottPhillips/1561267 to your computer and use it in GitHub Desktop.
Save ScottPhillips/1561267 to your computer and use it in GitHub Desktop.
Using the PHP SDK to run FQL queries using the Facebook Graph API
<?php
$facebook = new Facebook(array(
'appId' => 'YOUR_API_KEY',
'secret' => 'YOUR_API_SECRET',
'cookie' => true,
));
$fql = "SELECT page_id, name from page where name='Coke'";
$response = $facebook->api(array(
'method' => 'fql.query',
'query' =>$fql,
));
print_r($response);
?>
<?php
$param = array(
'method' => 'fql.query',
'access_token' => $cookie['access_token'],
'query' => $fql,
'callback' => ''
);
$response = $facebook->api($param);
print_r($response);
?>
@Conereven215
Copy link

Please allow me to reuse the code you shared? house of hazards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment