bryanforst
bryanforst

Reputation: 67

Facebook php sdk stopped returning api values

We have been using the Facebook php sdk since August 2011 to do our oauth registration and validation. Sometime last month it broke. By broke i mean the $me = $facebook->api('/me'); call suddenly started returning a blank array - no errors thrown nothing. No changes have been made to this part of the system for several months.

I took this as an opportunity to migrate to v3.1.1 but that had no effect.

We are running a php page inside a jsp/Tomcat installation so we are using quercus. Ive run this as plain php and get the same results.

Since I have not seen a general alarm raised I assume it must be something in our site but I cannot isolate anything. Any idea? Here is the php code ( we have a user so we are in the AUTHENTICATED block of code - the $me array contains nothing)

<?php
$request = quercus_servlet_request();
$page = $request->getAttribute("page");

include_once 'facebook.php';

$facebook = new Facebook(array(
'appId'  => $request->getAttribute("appId"),
'secret' => $request->getAttribute("secretKey"),
'cookie' => true
));


if(is_null($facebook->getUser())) {
    $url = $facebook->getLoginUrl(array('next' => $request-  >getAttribute("canvasUrl"),'req_perms' => 'publish_stream'));
    $page->Log("LOGIN URL",$url);
    echo "<script type='text/javascript'>window.top.location.href = '$url';</script>";
    exit;
} else {
    try {
        $page->Log("AUTH","AUTHENTICATED");
    $uid = $facebook->getUser();
        $me = $facebook->api('/me');
        $page->Log("UID",$uid);
        $page->Log("ME array",print_r($me, true));

        $request->getSession()->setAttribute("authenticated","T");
        $request->getSession()->setAttribute("fbuid",strval($uid) );
        $request->getSession()->setAttribute("fname",$me['first_name']);
        $request->getSession()->setAttribute("lname",$me['last_name']);
        $request->getSession()->setAttribute("accesstoken",$facebook- >getAccessToken());
    //$page->Log("fbuid",$request->getSession()->getAttribute("fbuid"));

.......

Upvotes: 1

Views: 197

Answers (1)

Venu
Venu

Reputation: 7279

Right now facebook is having some down time all over the world. You might see some strange issues.

But you should consider testing you app using graph API explorer here and confirm issue is on your side or facebook enter image description here

Select your app on right top and query the API.

For me its working fine(India).

Upvotes: 1

Related Questions