Skip to content

Instantly share code, notes, and snippets.

@masayuki5160
Created September 14, 2014 07:28
Show Gist options
  • Save masayuki5160/9e65c582c51c7e451faa to your computer and use it in GitHub Desktop.
Save masayuki5160/9e65c582c51c7e451faa to your computer and use it in GitHub Desktop.
FBのScoreをリセットする
<?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;
}
?>
@masayuki5160
Copy link
Author

@masayuki5160
Copy link
Author

{"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