Q:

GAE, PHP and GCM: failed to open stream: HTTP request failed! HTTP/1.0 405 Method Not Allowed

I'm developing a web application (using GAE for PHP) that notifies android clients (via GCM - Google Cloud Messaging) when some content are available for download.
The following PHP script should do job:
$json = array( 
    'data' => array( ... ), 
    'registration_ids' => array( ... )
);

$data = json_encode( $json );
$context = array( 
    'http' => array(
        'method' => 'post',
        'header' => 'Authorization: key=MY_SECRET_KEY' . "\r\n" .
                    'Content-Type: application/json' . "\r\n",
        'content' => $data
    )
);
$context = @stream_context_create($context);
$result = @file_get_contents("https://android.googleapis.com/gcm/send", false, $context);

The above code runs correctly when the app is deployed, but do not when running on my local development environment.
On local development environment $result is null and the file_get_contents "echo" the following warning failed to open stream: HTTP request failed! HTTP/1.0 405 Method Not Allowed.

A:

I finally figured out what was happening.
The HTTP/1.0 405 Method Not Allowed was related with the 'method' => 'post'.
Belive me, simply changing it to 'method' => 'POST' (note the uppercase!) did the trick.

