3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $username = 'stn'; $password = '$ta7$T5d'; $url = 'https://purpleportal.net/api/location/v1/ping'; $token = base64_encode($username . ':' . $password); $curl = curl_init(); $headers = [ "Content-Type: application/json", "Authorization: basic " . $token, ]; curl_setopt_array($curl, [ CURLOPT_RETURNTRANSFER => 1, CURLOPT_HEADER => true, CURLOPT_URL => $url, CURLOPT_HTTPHEADER => $headers ]); $output = curl_exec($curl); // $info = curl_getinfo($curl, CURLINFO_HTTP_CODE); // var_dump($info); var_dump($output);
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/3HtOl:7 Stack trace: #0 {main} thrown in /in/3HtOl on line 7
Process exited with code 255.
Output for 5.4.2 - 5.6.28
Fatal error: Call to undefined function curl_init() in /in/3HtOl on line 7
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/3HtOl on line 8
Process exited with code 255.