tags:

views:

70

answers:

0

Hello,

Is it possible to delete a post using facebook's php sdk? I've been trying all sorts of things but I get this error:

Fatal error: Uncaught OAuthException: (#200) This post wasn't created by the application thrown in C:\xampp\htdocs\auth\facebook.php on line 523

My code:

<?php

require "facebook.php";

$facebook = new Facebook(array(
    "appId" => "<appId>",
    "secret" => "<secret>",
    "cookie" => 1
));

if ($facebook->getSession())
{
    echo "<a href='" . $facebook->getLogoutUrl() . "'>Logout</a>"; 
    $user = $facebook->api("/me/feed?access_token=" . $facebook->getAccessToken());
    $facebook->api("/" . $user["data"][0]["id"] . "?access_token=" . $facebook->getAccessToken(), "DELETE");
}
else
{
    $loginUrl = $facebook->getLoginUrl();
    echo "<a href='$loginUrl'>Login</a>";
}

?>

Or is there something wrong?