3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Replace with the real server API key from Google APIs $apiKey = "your api key"; // Replace with the real client registration IDs $registrationIDs = array( "reg id1","reg id2"); // Message to be sent $message = "hi Shailesh"; // Set POST variables $url = 'https://android.googleapis.com/gcm/send'; $fields = array( 'registration_ids' => $registrationIDs, 'data' => array( "message" => $message ), ); $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_POSTFIELDS, json_encode( $fields)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // curl_setopt($ch, CURLOPT_POST, true); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode( $fields)); // Execute post $result = curl_exec($ch); // Close connection curl_close($ch); echo $result; //print_r($result); //var_dump($result); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/7Smc7:24 Stack trace: #0 {main} thrown in /in/7Smc7 on line 24
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
60.64 ms | 401 KiB | 8 Q