Trying to post an image along with wall post was working fine for couple of months with the following code. Suddenly it stopped working.
When I test it with https it doesn’t work but in http it works.
The APP URL is using https if the protocol is https and http otherwise.
$protocol = "http";
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!="off")
$protocol = "https";
define("CANVAS_URL","$protocol://apps.facebook.com/appname/");
define("APP_URL","$protocol://domain.com/content/appname/live/");
FB.ui(
{
method: 'feed',
name: 'my app name',
link: <? echo "'".CANVAS_URL."'";?>,
picture: <? echo "'".APP_URL."'";?>+image,
caption: _caption,
description: _description
}, function(response) {
if (response && response.post_id)
{
// published
} else {
// not published
}
}
);
Try not using an SSL URL to get the image (but still using it for your linked CANVAS_URL). Facebook proxies the image requests it shows to users, so even if you’re serving it from a non-SSL URL, the image used within Facebook will reach users over SSL.
As to why the SSL URL isn’t working, it could be that the crawler used by Facebook to retrieve the image doesn’t recognize the certificate chain you’re using. Yours worked fine for me in a browser, but when retrieving via
wgeton a Linux command line (likely a closer environment to FB’s crawler than a browser is), there’s a failure to verify the certificate.