像Statu Ajax Post Graph Api
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了像Statu Ajax Post Graph Api相关的知识,希望对你有一定的参考价值。
我使用此代码为喜欢状态,但从昨天起它不起作用。如何使用php&curl或ajax进行喜欢状态?
$statusid = $_POST['url'];
$ac_to = mysql_query("Select access_token From users order by rand() ".$limit."");
while($yaz=mysql_fetch_array($ac_to)) {
$access_token = $yaz['access_token'];
//Atııl Kurt
}
$params = array('access_token'=>$access_token);
$url = "https://graph.facebook.com/".$statusid."/likes?access_token=".$access_token."";
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_POSTFIELDS => $params,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_VERBOSE => true,
));
$result = curl_exec($ch);
您可以使用PHP或javascript SDK通过FB.api执行fql请求。你需要查询这里看到的like表:http://developers.facebook.com/docs/reference/fql/like/?refsrc=http%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Freference%2Ffql%2F&refid=9&_rdr
Javascript:http://developers.facebook.com/docs/reference/javascript/
PHP:http://developers.facebook.com/docs/reference/fql/
查看此问题以通过cURL查看fql:FQL Query from PHP using cURL returning "Method Not Implemented"
编辑:
Javascript FQL示例:
FB.api(
{
method: 'fql.query',
query: 'SELECT name FROM user WHERE uid=me()'
},
function(response) {
alert('Your name is ' + response[0].name);
}
);
您可以在此处访问我的教程来查看如何使用Javascript SDK:http://www.epixseo.com/index.php/facebook-php-3-3-1-and-javascript-sdk-graph-api-tutorial/
以上是关于像Statu Ajax Post Graph Api的主要内容,如果未能解决你的问题,请参考以下文章
jQuery Ajax Post - 无法使用回调函数设置全局变量?
AngularJS入门教程之与服务器(Ajax)交互操作示例
论文笔记:FILLING THE G AP S: MULTIVARIATE TIME SERIES IMPUTATION BY GRAPH NEURAL NETWORKS