2010-04-28 53 views
0

即時嘗試更新我的新聞在Facebook上。我使用新的圖形api。我可以連接到圖形,但是當我嘗試將一些內容發佈到提要對象時,什麼都不會發生。facebook圖表api不會發布到新聞Feed

here's我的代碼:

<?php 
$token = "xxxx"; 

$fields = "message=test&access_token=$token"; 

$c = curl_init("http://graph.facebook.com/me/feed"); 
curl_setopt($c,"CURLOPT_POST", true); 
curl_setopt($c,"CURLOPT_POSTFIELDS",$fields); 

$r = curl_exec($c); 
print_r($r); 

這將返回:

{"error":{"type":"QueryParseException","message":"An active access token must be used to query information about the current user."}}1 

然後我試圖通過通過GET ACCESS_TOKEN:

$c = curl_init("http://graph.facebook.com/me/feed?access_token=$token"); 

這將返回:

{"data":[]}1 

我做錯了什麼?

謝謝

+0

有點晚了,但你可以試着澄清一下嗎?有 林同樣的問題,現在我得到它返回: { 「數據」:[]} 1 那麼究竟你是如何解決這個? 謝謝 – 2011-03-09 12:10:52

+0

我把curl選項設置爲字符串... curl選項的正確值是常量...而不是curl_setopt($ c,「CURLOPT_POST」,true);你應該做curl_setopt($ c,CURLOPT_POST,true); – rizidoro 2012-10-22 16:54:43

回答

0

我發現我的錯誤! 我把CURL選項作爲一個字符串而不是常量。 oopps ...

相關問題