I'm tryng to get the cover url of a FBpage using:
$fql_query_url = "https://graph.facebook.com"
."/$fb_id[id]?fields=cover"
."";
try {
$fql_query_result = @file_get_contents($fql_query_url);
$fql_query_obj = json_decode($fql_query_result, true);
} catch(Exception $o){ }
$cover = $fql_query_obj[cover][source];
I get an http://... url and not the https://... url
any tips?
As @CBroe pointed out, you need to specify you need a secure URL by setting the return_ssl_resources argument to 1: https://graph.facebook.com/wtf.no.username/picture?return_ssl_resources=1.
Edit: Please note that this isn't FQL (Facebook Query Language), this is just a standard API call.
After getting the url, you can replace http to https with preg_replace()
in PHP.
$cover = $fql_query_obj[cover][source];
$secure_cover = preg_replace('/^http(?=:\/\/)/i','https',$cover);
As far as i tested, it works fine.
You can also change this with javascript.
cover = cover.replace(/^http:\/\//i, 'https://');
hope this help someone :)