Using Google App Engine, when calling my API using POST method, it shows as GET - why?
This is my code:
function call_api($client_id, $client_secret, $data) {
$api_url = 'http://myapp.com/api.php';
$options = array(
'http' => array(
'header' => "Authorization: Basic " . Base64_encode("$client_id:$client_secret") . "
Content-type: application/x-www-form-urlencoded
",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($api_url, false, $context);
return $result;
}
The first line of api.php is:
echo "<pre>"; print_r($_SERVER); echo "</pre>";
And within that output, I see:
[REQUEST_METHOD] => GET
How/why could this be happening?
It's also worth mentioning that the method shows as POST when testing this code on GAE's SDK.