1

我尝试删除我通过 php 使用 app 上传的照片

上传示例的结果:

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

1
 $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

于 2013-10-11T23:58:31.377 回答