Skip to content

Instantly share code, notes, and snippets.

@httpspace
Last active August 18, 2020 07:38
Show Gist options
  • Save httpspace/714f14c603358be5e445b93d6f0f6a6e to your computer and use it in GitHub Desktop.
Save httpspace/714f14c603358be5e445b93d6f0f6a6e to your computer and use it in GitHub Desktop.
$input = array(
"access_token" => 'token',
"message" => '文字',
'url' => '圖片網址,
'method' => 'photos'
);
postFb($input);
function postFb($id, $input){
$method = $input['method'];
unset($input['method']);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://graph.facebook.com/".$id."/{$method}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $input);
$response = curl_exec($ch);
return $return_array = json_decode($response, true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment