3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Replace with the real server API key from Google APIs $apiKey = "AIzaSyBFtNb7a_TCtxSqkiWUc5qGKVJ1KJtIa0s"; // Replace with the real client registration IDs $registrationIDs = array("APA91bHxXsOqvgC9uGcdZ7rV0EukYbS7pQY4Y4wqMfeh4xtJ0F_vXzvN1Uk6g0mWz2opmcfUYM9VrlfFpPBj0ND4lHVOqbVAPU5FiJ03Q8AwrCb7UIuK67Sveh5yGCPsi_rPcTIbMjAk"); // 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 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/vpIAA:24 Stack trace: #0 {main} thrown in /in/vpIAA on line 24
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/vpIAA:24 Stack trace: #0 {main} thrown in /in/vpIAA on line 24
Process exited with code 255.

preferences:
144.39 ms | 401 KiB | 173 Q