3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Initialisation des variables $clientId = "14254"; $consumerKey = "MTQyNTQ6NDQw"; $consumerSecret = "568a3e7ba52943b78587f2e86d9a57b8"; // Header de la requête $headers = array( "grant_type" => "password", "client_id" => $clientId, "username" => $consumerKey, "password" => $consumerSecret, "content_type" => "application/x-www-form-urlencoded" ); $postText = http_build_query($headers); // URL d'appel $url = "https://api.ccmp.eu/services/authorization/oauth2/token"; try { // Initialisation de la session CURL $curl = curl_init(); // Appel de l'URL en paramètre curl_setopt($curl, CURLOPT_URL, $url); //HTTP POST request curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $postText); //set SSL curl_setopt($curl, CURLOPT_SSLVERSION, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // Demande le résultat en chaîne de caractères curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // Execution de la session CURL $result = curl_exec($curl); // Récupère le code de la réponse retournée $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); // Fermeture de la session CURL curl_close($curl); // Création d'un tableau contenant le code de retour et le résultat de la requête $res = array_merge(array('code' => $code), array('result' => json_decode($result, true))); } catch ( Exception $e ) { throw new Exception("Error during the call. Here the message: " . $e -> Message); } print_r($res);
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.6
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/QTjnj:22 Stack trace: #0 {main} thrown in /in/QTjnj on line 22
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.28
Fatal error: Call to undefined function curl_init() in /in/QTjnj on line 22
Process exited with code 255.

preferences:
222.31 ms | 402 KiB | 226 Q