I am using
$access_token = $facebook->getAccessToken();
$facebook->setAccessToken($access_token);
$response = $facebook->api(
$post_id['id'],
'DELETE'
);
to delete a post from a Facebook page. I have the post id stored in mysql database and use
$ad_id = osc_ad_id();
$conn = getConnection();
$get_id=$conn->osc_dbFetchResult("SELECT * FROM %st_post_id WHERE ad_id = '$ad_id'");
$post_id = $get_id['post_id'];
to retrieve the id.
When I test it on my site and press the delete button it comes up with
Fatal error: Uncaught GraphMethodException: Unsupported delete request.
Although if I do it manually, and make $post = '5768877877667657_76576687667'
(fake id) then change the code
$access_token = $facebook->getAccessToken();
$facebook->setAccessToken($access_token);
$response = $facebook->api(
$post_id,
'DELETE'
);
it works and deletes the post.
So my question is what is the difference between retrieving the id from mysql and doing it manually ($post_id = '576768687878_7676765857875'
.
My row settings on mysql are type: varchar, collation: utf8_general_ci, and length: 50.
I have researched on stackoverflow for the solution but can't find anything.
I have also retreived the id on another page and then used echo to see if the format is correct, and it works, I even copied the echoed id and made $post_id
equal to it, and it successfully deletes the post.
The request only fails when I retreive the id from the database and make it equal a variable.