3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bitfinex { private $api_key; private $api_secret; private $api_version; private $base_url = 'https://192.230.80.104'; public function __construct($api_key, $api_secret, $api_version = 'v1') { $this->api_key = $api_key; $this->api_secret = $api_secret; $this->api_version = $api_version; } public function get_balances() { $request = '/' . $this->api_version . '/balances'; echo $request; $data = array( 'request' => $request, 'options' => array() ); return $this->send_signed_request($data); } private function prepare_header($data) { $data['nonce'] = 144800329405116; //(string) number_format(round(microtime(true) * 100000),0,'.',''); echo $data; echo '<br/>'; echo "Json encode"; echo '<br/>'; echo json_encode($data); echo '<br/>'; $payload = base64_encode(json_encode($data)); $signature = hash_hmac('sha384', $payload, $this->api_secret); echo "payload "; echo $payload; echo " sig "; echo $signature; echo " "; return array( 'X-BFX-APIKEY: ' . $this->api_key, 'X-BFX-PAYLOAD: ' . $payload, 'X-BFX-SIGNATURE: ' . $signature ); } private function send_signed_request($data) { $ch = curl_init(); $url = $this->base_url . $data['request']; // echo $url; $headers = $this->prepare_header($data); curl_setopt_array($ch, array( CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_POSTFIELDS => "" )); // $information = curl_getinfo($ch); echo $information; // echo $result; if( !$result = curl_exec($ch) ) { trigger_error(curl_error($ch)); echo "NO <br/>"; echo $result; return false; } else { echo "YES <br/>"; return json_decode($result, true); } } } $la = new Bitfinex('85FOKLshSVnZxRLtCoTFw2qHDIQf5TCEOWj9nk6CRBQ', 'E8AeyGATKUFmWLSWLGSYznRFmaoboxgGPzmRzgn0G8x', 'v1'); $drek = $la->get_balances(); //$information = curl_getinfo($curl_exect); echo '<br/>'; echo 'Recived data'; echo $drek; ?>
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 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
/v1/balances Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/nsBDT:60 Stack trace: #0 /in/nsBDT(27): Bitfinex->send_signed_request(Array) #1 /in/nsBDT(99): Bitfinex->get_balances() #2 {main} thrown in /in/nsBDT on line 60
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 /v1/balances Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/nsBDT:60 Stack trace: #0 /in/nsBDT(27): Bitfinex->send_signed_request(Array) #1 /in/nsBDT(99): Bitfinex->get_balances() #2 {main} thrown in /in/nsBDT on line 60
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
/v1/balances Fatal error: Call to undefined function curl_init() in /in/nsBDT on line 60
Process exited with code 255.

preferences:
234.1 ms | 401 KiB | 330 Q