3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Enter your code here, enjoy! class ICObenchAPI { private $privateKey = '196c979a-e3a5-40cc-8bf8-55edbb4af14b'; private $publicKey = '570d742e-21c0-4a8b-9f13-fbc30f00b804'; private $apiUrl = 'https://icobench.com/api/v1/'; public $result; public function getICOs($type = 'all', $data = ''){ return $this->send('icos/' . $type, $data); } public function getICO($icoId, $data = ''){ return $this->send('ico/' . $icoId, $data); } public function getOther($type){ return $this->send('other/' . $type, ''); } private function send($action, $data){ $dataJson = json_encode($data); echo $sig = base64_encode(hash_hmac('sha384', $dataJson, $this->privateKey, true)); echo '*'; echo strlen($dataJson); echo '*'; echo $this->publicKey; echo '*'; echo $sig; echo '*'; echo $dataJson; $ch = curl_init($this->apiUrl . $action); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $dataJson); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($dataJson), 'X-ICObench-Key: ' . $this->publicKey, 'X-ICObench-Sig: ' . $sig) ); $reply = curl_exec($ch); $ff = $reply; $reply = json_decode($reply,true); if(isset($reply['error'])){ $this->result = $reply['error']; return false; }else if(isset($reply['message'])){ $this->result = $reply['message']; return true; }else if(isset($reply)){ $this->result = json_encode($reply); return true; }else{ $this->result = htmlspecialchars($ff); return false; } } public function result(){ return $this->result; } } $api = new ICObenchAPI(); $api->getICOs("all"); echo $api->result;
Output for 7.1.0 - 7.1.12, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.4 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
o6wlgFpzWLKnLgBuG69YPrLRTSYjkRLSehBksPV0MFwCBG0flSvGAajHOgCMpuD3*2*570d742e-21c0-4a8b-9f13-fbc30f00b804*o6wlgFpzWLKnLgBuG69YPrLRTSYjkRLSehBksPV0MFwCBG0flSvGAajHOgCMpuD3*"" Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/ou9m5:34 Stack trace: #0 /in/ou9m5(12): ICObenchAPI->send('icos/all', '') #1 /in/ou9m5(70): ICObenchAPI->getICOs('all') #2 {main} thrown in /in/ou9m5 on line 34
Process exited with code 255.

preferences:
127.25 ms | 404 KiB | 155 Q