1

アプリでアップロードした写真をphpで削除しようとしています

アップロード例の結果:

 {"id":"429774393794352","post_id":"276744849097308_429774413794350"} 

最初にどちらの id または post_id を使用するか

そしてphpでそれを選択する方法??

curlライブラリのphpコードで削除するように命令する方法

私の考えは、すべての写真IDをSQLに保存していつでも削除することです

私が使用したアップロードコード

$file='./'.$new_string;






$args = array(
   'message' => $message,
);
$args[basename($file)] = '@' . realpath($file);
$ch = curl_init();
$url = 'https://graph.facebook.com/album id /photos?access_token='.$accsesss;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
$a1=$data = curl_exec($ch);
print_r(json_decode($data,true));
echo'<br/>';

私は試します

$args = array(
   'id' => '276744849097308_429774413794350',
   'access_token' => $accsesss ,


);
$ch = curl_init();
$url = 'https://graph.facebook.com/276744849097308_429774413794350?method=DELETE&access_token=$accsesss';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true); $a1=$data = curl_exec($ch);
print_r(json_decode($data,true));
echo'<br/>';

結果

Array ( [error] => Array ( [message] => Invalid OAuth access token. [type] => OAuthException [code] => 190 ) ) 
4

1 に答える 1