In php I try to get the profile picture like this :
$tmp = json_decode(file_get_contents('https://apis.live.net/v5.0/me?access_token='.$accesstoken),true);
echo $tmp['first_name']; // OK (not an accesstoken problem)
but if I do :
$picture = file_get_contents('https://apis.live.net/v5.0/'.$tmp['id'].'/picture?type=medium&access_token='.$accesstoken);
here I get nothing, nothing is returned, strange.
here is the link of the live api : https://msdn.microsoft.com/en-us/library/hh243648.aspx#user
they said :
Note To redirect a GET call to the URL of a user's picture, you can call /me/picture or /USER_ID/picture.
I also tried with https://apis.live.net/v5.0/me/picture => but doesn't work too
I don't understand at all, any idea?
Here is the API scope:
scope=wl.emails+wl.basic
I've replace file_get_contents with curl :
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $t);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$a = curl_exec($ch);
if(preg_match('#Location: (.*)#', $a, $r))
$picture = trim($r[1]);
and now I get this picture url :
https://cid-fbf213653beb66a0.users.storage.live.com/users/0xfbf213653beb66a0/myprofile/expressionprofile/profilephoto:UserTileMedium
and now :
if I open this url in a browser : KO (white page)
if I remove the bold part above, the browser download the picture (and I can read it if I add .png).
is there a way I get the picture without having to download it?