Use curl_setopt_array and enable http2 for speeding up CURL requests

This commit is contained in:
Joshua Ramon Enslin 2022-02-12 22:51:42 +01:00
parent 321609306d
commit 93991225fe
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -296,14 +296,17 @@ final class MD_STD {
$curl = \curl_init(); $curl = \curl_init();
\curl_setopt($curl, CURLOPT_URL, $url); \curl_setopt_array($curl, [
\curl_setopt($curl, CURLOPT_HEADER, false); CURLOPT_URL => $url,
\curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, $timeout); //timeout in seconds CURLOPT_HEADER => false,
\curl_setopt($curl, CURLOPT_TIMEOUT_MS, $timeout); //timeout in seconds CURLOPT_CONNECTTIMEOUT_MS => $timeout, //timeout in seconds
\curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); CURLOPT_TIMEOUT_MS => $timeout, //timeout in seconds
// \curl_setopt($curl, CURLOPT_COOKIESESSION, true); CURLOPT_FOLLOWLOCATION => true,
\curl_setopt($curl, CURLOPT_AUTOREFERER, true); CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2_0,
\curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2'); // CURLOPT_COOKIESESSION => true,
CURLOPT_AUTOREFERER => true,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2',
]);
/* /*
if (!file_exists(__DIR__ . '/../../curled.txt')) { if (!file_exists(__DIR__ . '/../../curled.txt')) {