How can I Delete Photo On facebook Pages via PHP SDK?

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 ..

Answers


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
   }
}

Need Your Help

How can kernel threads ask pages for only themselves?

linux memory kernel address-space

As you know, every kernel threads share one kernel memory space. The mm field of the task_struct describing a kernel thread is null. It uses the mm field of 'priv' task.

iOS/UIFont - reducing font width

iphone ios cocoa-touch fonts uifont

I have a UILabel that is a fixed size. Unfortunately on rare occasions, the text I need to fit into it doesn't fit! I have tried reducing the font size, but it needs to reduce so much that it looks