S
S
Sharov Dmitry2016-07-13 13:47:04
PHP
Sharov Dmitry, 2016-07-13 13:47:04

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
fd65358de9e84f90beb6e44876226cae.png
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)
}

There is no way to look at the 1s server side what it lacks, since it belongs to another company.
original picture https://habrastorage.org/files/fd6/535/8de/fd65358...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question