I'm using GCM in php. Everything is fine. But im getting response as
"Field \"data\" must be a JSON array: example\n"
My code for GCM is
function sendNotification($registrationIdsArray, $messageData) {
        $data = array(
            'data' => $messageData,
            'registration_ids' => $registrationIdsArray
        );
        var_dump($data);
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_HTTPHEADER, $this->header);
        curl_setopt($ch, CURLOPT_URL, "https://android.googleapis.com/gcm/send");
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
        $response = curl_exec($ch);
        curl_close($ch);
        return $response;
    }
and my $data object is
{"data":"example","registration_ids":["apikey1", "apikey2"]}
What is the missing code for GCM here.