'https://apis.live.net/v5.0/'.$response->id.'/picture', CURLOPT_FOLLOWLOCATION => 0, CURLOPT_HEADER => 1, CURLOPT_RETURNTRANSFER => 1, ]); $redir = curl_exec($curl); curl_close($curl); preg_match('/^Location: (.*)$/im', $redir, $m); $imageUrl = $m ? $m[1] : false; $email = (isset($response->emails->preferred)) ? $response->emails->preferred : null; return [ 'uid' => $response->id, 'name' => $response->name, 'firstname' => $response->first_name, 'lastname' => $response->last_name, 'email' => $email, 'image_url' => $imageUrl, 'urls' => $response->link.'/cid-'.$response->id, ]; } }