$ret = file_get_contents('https://oauth2.googleapis.com/token', false, stream_context_create([
'http' => [
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'protocol_version' => 1.1,
'content' => http_build_query([
'client_id' => $client_id,
'client_secret' => $client_secret,
'refresh_token' => $refresh_token,
'grant_type' => $refresh_token
])
]
]));
After running the script, I see a 400 Bad Request error. What did I do wrong?