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

发布于 2024-11-02 20:08:23 字数 1947 浏览 0 评论 0原文

我发现了一些关于使用 FQL 从 facebook 视频表中提取 JSON 数据的不同页面。

这会被视为 Facebook 应用程序吗?

我正在使用 PHP 4 运行 apache 服务器。我的查询如下:

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

Facebook 开发人员说 “您可以通过获取 https://api.facebook.com/method/fql.query?query=QUERY。您可以使用格式查询将响应格式指定为 XML 或 JSON参数。”

我应该吗只需做一个

<?
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);


?>

包含文件是这样的:https://github。 com/facebook/php-sdk/blob/master/src/facebook.php

我收到以下错误:

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] => ***************** ) ) ) 

任何信息或明确的方向都会很棒。

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_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

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人间☆小暴躁 2024-11-09 20:08:23

下面是最终运行的代码。

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;

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;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文