Jump to content

facebook graph api & php sdk, deleting events!


petroz

Recommended Posts

For the life of me, I cannot find a way to delete, cancel or remove facebook events I created & updated using the FB PHP SDK & the Graph API.

 

I've tried every single permutation found on facebook's documentation & stack overflow...

 

Here are some of the clues I have found on my quest..

 

https://developers.facebook.com/docs/reference/api/#deleting https://developers.facebook.com/docs/reference/api/event/ https://developers.facebook.com/docs/reference/rest/events.cancel/

http://stackoverflow.com/questions/2931387/facebook-sdk-and-graph-api-comment-deleting-error

http://stackoverflow.com/questions/2858748/facebook-api-delete-status

http://stackoverflow.com/questions/3832405/facebook-graph-api-delete-like

 

Here is what I have tried so far.

function delete_fb_event($event_data, $data)
{
    //load the user for offline access and userid
    $user = $this->load_user($data['aid']);

    if(!empty($user[0]['fb_offline_access']))
    {
        //instantiate Facebook API
        require 'facebook.php';
        $facebook = new Facebook(array(
          'appId'  => 'BLAHBLAHBLAH',
          'secret' => 'BLAHBLAHBLAHBLAHBLAHBLAH',
          'cookie' => true,
        ));

        $fb_event = array(
            "access_token" => $user[0]['fb_offline_access'],
        );

        $result = $facebook->api('/'.$event_data['fb_event_id'], 'DELETE', $fb_event); //Uncaught GraphMethodException: Unsupported delete request
        //$result = $facebook->api('/'.$user[0]['fb_id']."_".$event_data['fb_event_id'], 'POST', array('access_token' => $user[0]['fb_offline_access'], 'method' => 'delete')); Uncaught OAuthException: (#803) Some of the aliases you requested do not exist
        //$result = $facebook->api('/'.$event_data['fb_event_id']."_".$user[0]['fb_id'], 'POST', array('access_token' => $user[0]['fb_offline_access'], 'method' => 'delete')); Uncaught OAuthException: (#803) Some of the aliases you requested do not exist  
        //$result = $facebook->api('/'.$event_data['fb_event_id'], 'POST', array('access_token' => $user[0]['fb_offline_access'], 'method' => 'delete')); Uncaught GraphMethodException: Unsupported post request
        //$result = $facebook->api('/'.$user[0]['fb_id']."_".$event_data['fb_event_id'], 'POST', array( 'access_token' => $user[0]['fb_offline_access'], 'method' => 'delete' )); Uncaught OAuthException: (#803) Some of the aliases you requested do not exist
        return $result;         
    }
    else
    {
        echo "error3"; //no FB offline access
    }       
}   

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.