true, CURLOPT_CONNECTTIMEOUT_MS => 500, CURLOPT_TIMEOUT_MS => 1000, CURLOPT_HTTPHEADER => [ 'Accept: application/json', ], ]); $started = microtime(true); $body = curl_exec($curl); $elapsed = microtime(true) - $started; if ($body === false) { $errno = curl_errno($curl); $error = curl_error($curl); curl_close($curl); printf("cURL error %d after %.2f seconds: %s\n", $errno, $elapsed, $error); exit(1); } $status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE); curl_close($curl); printf("HTTP status: %d\n", $status); printf("Elapsed: %.2f seconds\n", $elapsed); printf("Response body: %s\n", trim($body));