3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Replace with real BROWSER API key from Google APIs $apiKey = "AIzaSyC5h1xbiGhEwaRk-tOQrQeFtMlWwmHtwH4"; // Replace with real client registration IDs. $registrationIDs = array( //"APA91bEbJescMxpwm0PMZd-UspllvFnrwUA0X2A3oWmERbCqpXjHDZVx7szq-ldZaYg9X1a9JEk8bQGkv_IibQL2U6L9HTR9-MQAXXcZ6tOvKlNxEbD0HLyCV9GSkkvwn2G2QNFSUVUbXUP_inlQwj5CHvKBeo0CdQ");//S3 //"APA91bEWRtIhum6Xi4pxn4tcCnb1wSq6gv0Hm6R20v1BelZh9dLQpg_UfAar8MMXj4XOR78EiyfFWum3sVNx18Qs86cjlIolI22_PLJJwuA4atecqt3cIbWW20-PaF2kD2pyvRmXlI8dHTUnpASz_-EoAvwHwmMduw");//CL - Mobile5 //"APA91bHtmlWTKy6K_xVwnUebzMDvAdmMIbGBP6fxItZbbjhh3GzEC0VMSJMsKCyOAU05yalNnWCc7hqw-V5BwhZ_vKYn3LnEsU-4gSaCPLzSdWB9ooj_7O0U2ewe440TDB5HmUhM1giY2kMjPnYWPCK-s7jDv51UGQ");//Keyboard //"APA91bFg4uqthQ9HSHDZd6DlC3bRz8D2kt40w4CWCiOLsJNhiLBg_jd4LEcxORNPcJ8XEeniLtggPOkypm9hAXJFEIG6R9H6NOwmiGaEQMdQ8DNl3hSmzwqmYOtTcAYiF5gDQTFT_TMFfxrfgqIizMv4xexHRzNK9g"); //Live Phone - Droid 4.0 //"APA91bE04AEsBIf8urAAs4hsttP3DnM92FFRB3Gzf75OW89VGLDlKYIEYQNUk7ptxl2Y9t2bskma73SeZDmO-k4UIhmZeyGmJqZrUpyqaclAiKJ2JAxpuMvgfe9rOmH09ko_5RtjaEfdjvn7bj9IPqEI3Py3MMOs9Q");//FL - Droid 4.0 //"APA91bEWP_UryT8nZc-rCeXljGBiq9gYyr1acJT2NlqJiDKHu7WEEB7kOEVmiI12hXqr8kafasGnDphjxPjGTwvJOG__7zoOpPD5VwJ-AI25PLZo11xybGlEXQeAwQpwvdq4JFMcTd9-uaHrwFJE8DGsFGX5oGHW2g");//HTC Purple //"APA91bHp2C2eCzeKA9GBnSny1ZBC-hOM_axAITcvMq5qe_hM_NOcNPUlILjgzFkPeKrMntkJvg4eFCApaEQTY4DQqX-E-r0rO1lGxu91mdu026GKImvbP7PwMgr48_NZhXi73v4VigCyZQ8La3FlZxu5AuFEQaJ5Rg");//Droid X2 //"APA91bFrALO9itzFOcAQcPdNelaK5yyv9Xde8oHxshypAt7agpnyE40-EPi7YFiWERqr44qrFv9c82bJhSXxHPY28NdCPAMcYebclHA4iMwcUHnXsa3IzD3qH2v3xsTpRLRg8nujKLxbYrDDZbEWYyIrVQG5lH1PLA");//My Keyboard - Mobile9 //"APA91bEhF3EHsvJEMo-WUHsIu-APWALnEwiWn0WVh9dwhf2rR9Kb0bxj-kqyf-m5w8pRzPG-ixGu5Q8hkOwodtvQVdm2hYxEEtOp5-mtQVBT7tq3GwMDEbh6zGQi0PmQksmnN1PlruMFWVIKKQKCb9z3qaEQq3R2vg");//HTC4 - Mobile4 "APA91bEjV01rZKePGrlgKH__n76BhF0OclP_urQWX4l_qfXJKC1kM3yHematwcNBiY5x0ZSY1qC89xKyGx5VaH3UDdds0HxBrwE3wcOfkJKEkBhRVeuyKF1wAAww0d4TxNQsvZavSLlOnAVLgBtvb1yRwBi2GP2Cbg");//S4 - Mobile19 //"APA91bFIWmNzFY01Tusn8Isj4qexRa0sih6eHK5V9kkksiItA0tvA2-ZDxC_MZVddCcD9dE1-LXfVVhQufdb16ImkWSy5FiCupbbx1DsRNCk5dRDCEO2x_UNJTEeZlII0Zzxi9ETpyw7NjEKF5ZUY3g09C5HcR1OCA"); //Note 3 - Mobile 23 // Message to be sent $message = "New message received"; $type = "email"; //$message = "New video received"; //$type = "videogram"; // Set POST variables. $url = 'https://android.googleapis.com/gcm/send'; $fields = array( 'registration_ids' => $registrationIDs, 'data' => array( "message" => $message, "type" => $type) ); $headers = array( 'Authorization: key=' . $apiKey, 'Content-Type: application/json' ); // Open connection $ch = curl_init(); // Set the url, number of POST vars, POST data curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_POST, true ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $fields ) ); // Execute post $result = curl_exec($ch); // Close connection curl_close($ch); // Echo success or failure echo $result; ?>
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/uOsam:41 Stack trace: #0 {main} thrown in /in/uOsam on line 41
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Output for 5.0.0 - 5.6.28
Fatal error: Call to undefined function curl_init() in /in/uOsam on line 41
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: curl_init() in /in/uOsam on line 41
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: curl_init() in /in/uOsam on line 41
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: curl_init() in /in/uOsam on line 41