문제

I have a problem . I want to delete photos on facebook page , photos are sending via php sdk.

Im try all but not work..

$Curl_Session = curl_init('https://graph.facebook.com/[photoid]');
 curl_setopt ($Curl_Session, CURLOPT_POST, 1);
 curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, "method=DELETE&access_token=$token");
 curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($Curl_Session, CURLOPT_RETURNTRANSFER, 1);

 echo $a8=curl_exec ($Curl_Session);
 curl_close ($Curl_Session);

Dont work..

$url = 'https://graph.facebook.com/'.$id.'?method=DELETE&access_token='.$token;
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_CUSTOMREQUEST, "DELETE");
echo $data = curl_exec($ch);


This code is dont work


$sonuc=file_get_contents("https://graph.facebook.com/".$id."?method=DELETE\&access_token=".$token);

Please Help..

Facebook allowed deleting photos if sending via php sdk. But all codes not work ..

올바른 솔루션이 없습니다

다른 팁

First off, the photo you're trying to delete must have been uploaded by the app that's trying to delete it. This is mentioned in the Facebook Documentation: A photo can only be removed by the same app that published it.

You'll need a valid Page Access Token to delete the photo too. You can get this my adding the manage_pages permission and calling /me/accounts to get the list of access tokens, finding the one for the correct page).

Finally, calling: https://graph.facebook.com/{PHOTO_ID}?access_token={PAGE_ACCESS_TOKEN}&method=DELETE will delete the photo if the app has permission, otherwise you'll receive a error like:

{
   "error": {
      "message": "(#200) Permissions error",
      "type": "OAuthException",
      "code": 200
   }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top