I tried to implement **Google Cloud Messaging (GCM)** for **`iOS`** in my App. I tried the codes provided on the **`pod`** **GcmExample** `Xcode Project` and wrote a **`PHP`** script the will send the request via `PHP cURL`.

My **`PHP`** code is as follows:

```
gcmPush(
    "kU6GAbdQEg0:APA91bGSF42WITzubJ9lwQ2qUqL4ETtZfQEOthazc4tP1CRhxx8tKSRChwgtFK37-kt7RjG2P_Ncj2bDOONpPVsYkjxCNi3NDhMNWSkJ7pnlR83jdbMJfOKlD1CPXCgAvZjbwpzdeiTa", 
    "This is only a test from GCM for iOS.", 
    "PHP test"
    );

function gcmPush($GCM_regID, $message, $title) {

    $GOOGLE_API_KEY = "AIzaSyAd8pw7_J8i-FPswnhUMkFCDHtufSCFFTc";
    $url = 'https://android.googleapis.com/gcm/send';

    $fields = array(
        'to' => $GCM_regID,
        'notification' => array(
            'sound' => 'default',
            'badge' => '1',
            'body' => $message,
            'title' => $title
        )
    );

    $headers = array(
        'Authorization: key=' . $GOOGLE_API_KEY,
        'Content-Type: application/json'
    );

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));

    $result = curl_exec($ch);
    echo "\r\n";
    if ($result === FALSE) {
        die('Failed: ' . curl_error($ch) . "\r\n");
    } else {

        echo "Success\r\n";   
    }

    curl_close($ch);
}

```

The request is successful, however the result from the **Google GCM server** contains the following:

> 
> `{"multicast_id":6164898138439370127,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InternalServerError"}]}`
> 
> 
> 

Is there anything wrong with the **Google API Key**?
I tried this script to send Remote Notification to the **`GcmExample.xcworkspace`** and it worked.
I would like to know how to resolve this.