I’m in the process of moving a PHP Facebook Webpage (App) I didn’t originally write from one server to another. It was written a while ago on Version 2.1.2 of the API but I’m not allowed to upgrade yet, my client just wants it moved.
At first I had a few issues with the Certificate since the new server uses a Thawte SSL certificate which is properly installed since they have their e-commerce offering running just fine with it, but I couldn’t quite get the FB app to behave, so I ended up putting the following in place which got rid of the “Invalid or no certificate authority found” problem:
$opts[CURLOPT_SSL_VERIFYPEER] = false;
Now the entire app works including sending of emails etc. except one part – the part where it needs to post to the Page wall. This code works perfectly when run from the old server, but not on the new server:
$args = array(
'message' => $fbPostToWallMsg,
'name' => "New Entry",
'caption' => 'Click to view image.',
'picture' => $hostUrl.$filePath,
'access_token' => $oauthToken
);
$facebook->setFileUploadSupport(true);
try {
$data = $facebook->api('/'.$pageId.'/feed', 'post', $args);
} catch (Exception $e) {
$authError = true;
}
... other stuff, emails etc.
The $pageid is the same as before, the access_token seems valid and most people have already given permission to the app, but I have also tried with new unknown and existing known users and neither seems to work.
There are no errors that I can get hold of, no exception occurs when posting, the post just fails to appear on the wall – no indication is given that it didn’t work and I’ve checked the “hidden posts” in case they were treated as spam and they’re not there either.
Does anyone know why the code that works on one server doesn’t work on another? The only thing I can think of could be SSL issues, but I don’t know what those would be, and I don’t understand why I’m not seeing any errors thrown when posting to facebook.
Any help much appreciated,
Thanks
Turns out this was because the new server had a block on the firewall against http://www.facebook.com. I find it strange that the API fails silently because of this, but I guess what did I expect…
As soon as a hole was punched through the firewall for that server, it started working… sigh