Is anyone else noticing that facebook and twitters APIs aren’t working?
For facebook even if I allow my application to have access to my wall
$facebook->getUser()
Is always 0… When I try to open getLoginUrl it just open pop-up and redirect it instantly to success return link…
Here is code:
require_once 'src/base_facebook.php';
require_once 'src/facebook.php';
$app_id = 'xxx';
$app_secret = 'xxx';
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'oauth' => true,
'cookie' => true
));
$req_perms = "publish_stream";
$user = $facebook->getUser();
if (!$user)
{
$loginUrl = $facebook->getLoginUrl(array('display' => 'popup', 'redirect_uri' => 'http://xxxx.com/return_close.php?success=1', 'cancel_url' => 'http://xxxx.com/return_close.php?success=0','req_perms' => $req_perms, 'scope' => $req_perms));
}
And for twitter it’s like someone mistyped return link…
When I open getAuthorizeURL and when I log in it redirects me to this URL:
https://twitter.comoauth_callback/?oauth_token=yA2xjLsVRm9tIuVEysXnCV8R7TISW8tF94uznn7zlw&oauth_verifier=Io1N2I8zOEzJeBWI77WXFMqmMRNDfCrXZGQxXmxJLbI
Yes, https://twitter.comoauth_callback/ is right, there is no / after .com, it’s together, so I get not found page…
It’s like both APIs have serious problems… Facebook sometimes work and sometimes doesn’t, it’s buggy a lot…
Facebook library downloaded from OFFICIAL GitHub page. Tried versions:
v3.1.1
v3.1.0
v3.0.1
And none of those work…
Update
Return URL ( redirect_uri ) MUST have facebook class included in file…
There is so many examples/documentations and none of those had this explained…
So, Facebook fixed… Twitter still not working…
Well, nothing is broken in the API. Where did you get the above code? and if you come up with it then based on what resource?
First of all, take a look at the example of the OFFICIAL PHP-SDK, you’ll notice the following:
facebook.phpfile has been included, why notbase_facebook.php? well because it’s included in thefacebook.phpfile!req_permsbut now to request permissions you just need to usescopebase_facebook.phpfor the params theFacebook()class expect:appId,secretandfileUploadONLYdisplayparameter if you know what you are doing!This been said, this is a rewrite of your code: