Home>

Prompt plz who can. Required using Yandex API Get a list of delivery options (). The request is as follows:

$ Data= Array (
    'Senderid'= >
 ≪
SenderID >
.
    'to'= >
 Array (
        'location'= >
 'Kaliningrad, Oktyabrskaya, 11',
        'geoid'= >
 22,
        'postalcode'= >
 '236006'
    ),
    'Dimensions'= >
 Array (
        'length'= >
 five,
        'width'= >
 3,
        'Height'= >
 five,
        'WEIGHT'= >
 5.2
    )
);
$ curl= curl_init ();
CURL_SETOPT ($ CURL, CURLOPT_URL, 'https://api.delivery.yandex.ru/delivery-options');
CURL_SETOPT ($ CURL, CURLOPT_PUT, TRUE);
CURL_SETOPT ($ CURL, CURLOPT_RETURNTRANSFER, TRUE);
CURL_SETOPT ($ CURL, CURLOPT_TIMEOUT, 10);
CURL_SETOPT ($ CURL, CURLOPT_HTTPHEADER, ARRAY (
    'Content-Type: Application /Json',
    'Authorization: Oauth ≪
Token >
'
));
CURL_SETOPT ($ CURL, CURLOPT_POSTFIELDS, JSON_ENCODE ($ Data, JSON_UNESCAPED_UNICODE));
$ Output= CURL_EXEC ($ CURL);

For any adjustments of the $ DATA array -$ Output returns NULL. Tocken is correct 100%, this stage is passed. Someone worked with this API?

HTTPS Turning off, and without correction of the data array, the rules work?

Jean-Claude2021-06-04 17:23:06

Disconnected, nothing has changed. About $ DATA wrote to the fact that the case is not in the array, does not return. The only observation is CURL_SETOPT ($ CURL, CURLOPT_PUT, TRUE) Returns 504, so they put the timeout, and if you replace the CURL_SETOPT ($ CURL, CURLOPT_CUSTOMRequest, "PUT"), then just NULL

Владислав Шимков2021-06-04 17:23:06

And in the office set up 1 region?

Jean-Claude2021-06-04 17:23:06

All Hood, Curl_Setopt ($ CURL, CURLOPT_SSL_VERIFYPEER, FALSE); Together with CURL_Setopt ($ CURL, CURLOPT_PUT, TRUE); CURL_SETOPT ($ CURL, CURLOPT_RETURNTRANSFER, TRUE); also did not work out, worked with curl_setopt ($ CURL, CURLOPT_CUSTOMRequest, "Put"); Thank you!)

Владислав Шимков2021-06-04 17:23:06