简体   繁体   English

使用FQL从Facebook提取视频表数据

[英]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. 我发现了一些有关使用FQL从Facebook视频表中提取JSON数据的页面。

Would this be considered a facebook app? 这将被视为Facebook应用程序吗?

I am running and apache server with PHP 4. I have the query as: 我正在运行PHP 4的apache服务器。查询如下:

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." Facebook Developer说: "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_link, 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 包含文件是这样的: 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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM