3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = "https://101@dev.ewingirrigation.com/rest/"; $api_key = 'gSJ5^sVWAWb=L#HAyVXd^WK+_WpX2kew'; $ts = time(); $salt = substr($ts,0,-2); $hash = hash("sha256", $api_key.$salt); $postfields = Array( 'hash' => $hash, 'ts' => $ts ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, utf8_encode(json_encode($postfields))); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded')); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp'); $response = curl_exec($ch) or die('no curl '.curl_error($ch)); $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $header = substr($response, 0, $header_size); $body = substr($response, $header_size); echo "<pre>"; echo $header; echo "<hr>"; print_r($body);
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.6
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/f3cli:11 Stack trace: #0 {main} thrown in /in/f3cli on line 11
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/f3cli on line 11
Process exited with code 255.

preferences:
104.58 ms | 402 KiB | 87 Q