0
我打了一個電話給https://login.windows.net/common/oauth2/token
和所收到的是這樣的:PHP:如何將GET/POST調用中的承載令牌傳遞給Azure API?
{
"token_type": "Bearer",
"scope": "Directory.Read.All User.Read",
"expires_in": "3600",
"ext_expires_in": "0",
"resource": "https://graph.windows.net",
"access_token": {{really_long_token_1}},
"refresh_token": {{really_long_token_2}},
"id_token": {{really_long_token_3}}
}
我必須託管在HostGator的一個網站,正試圖訪問我已經找到了在Azure上的API。
調用我在Azure上託管的API的GET
的正確形式是什麼?這是我到目前爲止有:
$url = 'https://myappservice.azurewebsites.net/api/getValues';
$options = array(
'http' => array(
'header' => array(
'x-ms-version: 2017-06-02',
'Authorization: Bearer {{really_long_token_1}}'
),
'method' => 'GET'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$var_dump($result);
我最終得到500
服務器錯誤而在進行此調用。