Answer the question
In order to leave comments, you need to log in
Why is a cURL GET request not being executed?
Good afternoon.
In POSTMAN I made a GET request that receives the token successfully:
Generated code for cURL PHP - but it doesn't work:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.selcdn.ru/auth/v1.0",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"X-Auth-User: 122267",
"X-Auth-Key: 0baN.L:66f"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Answer the question
In order to leave comments, you need to log in
I will assume that it CURLOPT_TIMEOUT => 0
gives 0 seconds for everything about everything. How about putting something non-zero there like, say, five?
CURLOPT_TIMEOUT - The maximum number of seconds allowed to execute cURL functions.https://www.php.net/manual/en/function.curl-setopt.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question