请求:
curl_setopt($ch,CURLOPT_URL,"https://securetoken.googleapis.com/v1/token?key=AIzaSyBtSpn3NQEztoJW5q7S6jSBeQSDlZ0gAEE");
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
$headers=array();
$headers[]="Content-Type: application/x-www-form-urlencoded";
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS,"grant_type = refresh_token & refresh_token =".$refresh_token);
$result = curl_exec($ch);
curl_close($ch);
if ($result == null) {
continue;
} else {
return $result;
break;
}
}
}
响应:
stdClass Object
(
[error] => stdClass Object
(
[code] => 403
[message] => Requests from this Android client application <empty> are blocked.
[status] => PERMISSION_DENIED
[details] => Array
(
[0] => stdClass Object
(
[@type] => type.googleapis.com/google.rpc.Help
[links] => Array
(
[0] => stdClass Object
(
[description] => Google developer console API key
[url] => https://console.developers.google.com/project/1087008891043/apiui/credential
)
)
)
)
)
)