Answer the question
In order to leave comments, you need to log in
Why does curl return an error?
It is necessary to automate the work on requesting prices from the supplier. Now this is done manually through the web face 1s. The supplier does not provide a full price list and you have to look in this way. Logging in via php curl normally returns a cookie with the session number and information about the user, and at this step everything is buzzing. But other requests return an error. I looked through verishark what data is sent requests look the same
Request script
function post_query($uri, $data, $headers){
$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_REFERER, "http://host.ru/Clients/ru_RU/");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_COOKIEJAR, storage_path() . "/cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, storage_path() . "/cookie.txt");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
return curl_exec($ch)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question