Created
September 14, 2014 07:28
-
-
Save masayuki5160/9e65c582c51c7e451faa to your computer and use it in GitHub Desktop.
FBのScoreをリセットする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// アプリケーションID | |
$app_id = ''; | |
// シークレットキー | |
$app_secret = ''; | |
$token_url = 'https://graph.facebook.com/oauth/access_token?' | |
. 'client_id='.$app_id.'&client_secret='.$app_secret.'&grant_type=client_credentials'; | |
// access token取得処理 | |
$token_response = file_get_contents($token_url); | |
$param = null; | |
parse_str($token_response, $param); | |
$app_access_token = $param['access_token']; | |
var_dump($app_access_token); | |
$api_request_parameters = array( | |
'access_token' => $app_access_token | |
); | |
$deleteRequestURL = 'https://graph.facebook.com/'.$app_id.'/scores'; | |
$deleteResult = http_delete($deleteRequestURL, $api_request_parameters); | |
function http_delete($uri, $postData){ | |
$ch = curl_init($uri); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData)); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
return $result; | |
} | |
?> |
{"error":{"message":"(#15) A desktop application is not allowed to make this call","type":"OAuthException","code":15}}
キャンバスかWebのアプリとして登録してないとだめなんかな?
しかもpublish_actionの許可いるとか???
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
developerのドキュメント
https://developers.facebook.com/docs/games/scores
これの日本語版ね
http://fb.dev-plus.jp/reference/getstart/app/scores/
参考プログラム
http://www.ivangabriele.com/php-how-to-use-4-methods-delete-get-post-put-in-a-restful-api-client-using-curl/