Path: C:\
<?php
ini_set('max_execution_time',259200);
ini_set('memory_limit' , '-1' ) ;
define('API_KEY', '75594207-b5d7-43bf-a7c2-571b3030308d');
class RequestAPI {
function getResponse($url) {
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
"accept: application/json",
"x-api-key: ".API_KEY,
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
$resp = curl_exec($curl);
curl_close($curl);
$out = preg_split('/(\r?\n){2}/', $resp, 2);
if(isset($out[1])){$body[1] = $out[1];}else{$body[1] = '';}
if(!isset($out[0])){$body[0] = '';}
else{
$headers = $out[0];
$headersArray = preg_split('/\r?\n/', $headers);
$headersArray = array_map(function($h) {
return preg_split('/:\s{1,}/', $h, 2);
}, $headersArray);
$tmp = [];
foreach($headersArray as $h) {
$tmp[strtolower($h[0])] = isset($h[1]) ? $h[1] : $h[0];
}
$headersArray = $tmp; $tmp = null;
$body[0]=$headersArray['x-ratelimit-remaining'];
}
return $body;
}
}
?>