PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, January 15, 2022

[FIXED] Delete facebook post with Graph API - trouble getting this to work

 January 15, 2022     facebook, facebook-graph-api, facebook-php-sdk, php     No comments   

Issue

I'm using the following to post a message on my Facebook page:

$attachment =  array(
    'access_token' => $access_token,
    'message' => 'This is a test Message 4:',   
    'name' => "This is a test Name 4",
    'link' => "http://slashdot.org/",
    'description' => "This is a test Description 4"
);

$ret_code=$facebook->api('/me/feed', 'POST', $attachment);

This works great.

How do I delete the same post using the facebook GRAPH api? I read the docs and it says to issue a POST like:

https://graph.facebook.com/COMMENT_ID?method=delete

To test I set this up in a simple form with submit button, POSTing the data to https://graph.facebook.com/COMMENT_ID?method=delete (substituting COMMENT_ID fro the 11111111111_111111111111 id returned from the original publish call. This returns "This API call requires a valid app_id".

What is the correct way to issue a DELETE command?


Solution

Since you are using the php-sdk you just issue this call:

$facebook->api("/COMMENT_ID","DELETE");


Answered By - ifaour
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing