Answer the question
In order to leave comments, you need to log in
Why doesn't the curl request follow the API example work?
Hello. Please explain what is the reason:
http request https://www.sima-land.ru/api/v2/delivery-company shows the necessary data in the browser.
And a request via curl according to the API, on Denver shows an empty page. The curl module is connected.
I create an index.php file with the following content:
<?php
$curl = curl_init(' https://www.sima-land.ru/api/v2/delivery-company ');
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/json'));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($curl);
curl_close($curl);
?>
API description was taken here - https://www.sima-land.ru/api/v2/help/?php#Transport...
Answer the question
In order to leave comments, you need to log in
It's strange, everything shows up for me. And where you then use the received value of the $json variable, it is not displayed anywhere in your code.
A lot of options, for example, no User-agent. Take Wireshark, record the traffic of the working request and yours, compare.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question