如何删除照片帖子ID Facebook通过抓取API PHP与curl


how to delete photo post id facebook by grab api php with curl

>我尝试删除我用 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 ) ) 
 $Curl_Session = curl_init('https://graph.facebook.com/429774393794352');
 curl_setopt ($Curl_Session, CURLOPT_POST, 1);
 curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, "method=DELETE&access_token=$masteracsess");
 curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($Curl_Session, CURLOPT_RETURNTRANSFER, 1);
 echo $a8=curl_exec ($Curl_Session);
 curl_close ($Curl_Session);

感谢您的帮助@CBroe