Created
January 4, 2012 18:11
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$param = array( | |
'method' => 'fql.query', | |
'access_token' => $cookie['access_token'], | |
'query' => $fql, | |
'callback' => '' | |
); | |
$response = $facebook->api($param); | |
print_r($response); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
im looking for a way to write an fql query into php for a website. I have followed the format but unable to get it to work. Im not a programmer so any help is greatly appreciated. Here is what I have:
'My apps id', 'secret' => 'My apps secret', 'cookie' => true, )); $fql = "SELECT name, checkin_count FROM place WHERE page_id = 39875583837"; $response = $facebook->api(array( 'method' => 'fql.query', 'query' =>$fql, )); print_r($response); ?>When I test the code, I get: Fatal error: Class 'Facebook' not found on line 1