开发者

Pulling video table data from Facebook using FQL

I have found a few different pages on pulling JSON data from the facebook video table using FQL.

Would this be considered a facebook app?

I am running and apache server with PHP 4. I have the query as:

SELECT vid, owner, title, description, thumbnail_link, embed_html, updated_time, created_time FROM video WHERE owner= ***myID****

Facebook Developer says "You can execute FQL queries by fetching https://api.facebook.com/method/fql.query?query=QUERY. You can specify a response format as either XML or JSON with the format query parameter."

Should I just do a

<?
ini_set("display_errors","2");
ERROR_REPORTING(E_ALL);

require 'include/facebook_api.php';

$facebook = new Facebook(array(
  'appId' => '******myID********',
  'secret' => '******MYSECRET**************',
  'cookie' => true,
));



$fql = "SELECT vid, owner, title, description, thumbnail_l开发者_开发技巧ink, embed_html, updated_time, created_time FROM video WHERE owner= *****FBID*******";

$response = $facebook->api(array(
'method' => 'fql.query',
'query' =>$fql,
));

print_r($response);


?>

The include file is this : https://github.com/facebook/php-sdk/blob/master/src/facebook.php

I am getting the following error:

stdClass Object ( [error_code] => 190 [error_msg] => Invalid OAuth 2.0 Access Token [request_args] => Array ( [0] => stdClass Object ( [key] => method [value] => fql.query ) [1] => stdClass Object ( [key] => query [value] => SELECT vid, owner, title, description, thumbnail_link, embed_html, updated_time, created_time FROM video WHERE owner= ***************** ) [2] => stdClass Object ( [key] => api_key [value] => ***************** ) [3] => stdClass Object ( [key] => format [value] => json-strings ) [4] => stdClass Object ( [key] => access_token [value] => ***************** ) ) ) 

Any info or solid direction would be great.


Below is the code that ended up working.

header('Content-type: application/xml');
//ini_set("display_errors","2");
//ERROR_REPORTING(E_ALL);

$enc = urlencode('SELECT vid, owner, title, description, thumbnail_link, embed_html, updated_time, created_time FROM video WHERE owner=****ID*****');
$contents = file_get_contents("https://api.facebook.com/method/fql.query?query=$enc");

echo $contents;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜