V
V
Valeriu Vodnicear2019-03-13 19:00:47
PHP
Valeriu Vodnicear, 2019-03-13 19:00:47

Why is the picture not downloading from My Warehouse?

A few weeks ago I downloaded pictures from My Warehouse and everything worked fine.
I will give the code of functions for downloading:

public function saveImgMoySklad($imgUrl, $pathSave, $username, $password) {

    $auth = base64_encode("{$username}:{$password}");
    $context = stream_context_create([
        "http" => [
            "header" => "Authorization: Basic $auth"
        ]
    ]);
    $homepage = file_get_contents($imgUrl, false, $context);
    if ($homepage) {
        file_put_contents($pathSave, $homepage);
        return true;
    } else {
        return false;
    }
}

right now, a 403 error is generated, which means that there is no access to this function, although nothing has changed
if the same URl: https://online.moysklad.ru/api/remap/1.1/download/...
open in a browser and enter login and the password, then everything is fine - downloading
what could be the problem? support service does not answer questions about the API

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