Answer the question
In order to leave comments, you need to log in
How to use a direct link from Yandex.disk correctly?
Good afternoon!
The essence of the problem:
There is a script:
$public_key = "https://yadi.sk/d/AvWmc-wb0fK1vw"; //публичная ссылка на Яндекс.Диск
$json_decode = json_decode(file_get_contents("https://cloud-api.yandex.net/v1/disk/public/resources/download?public_key=".$public_key),true); //получаем прямую ссылку
$link = $json_decode[href]; //выбираем только ссылку из JSON
echo '</br><a href="' . $link . '">Скачать</a>'; // выводим ссылку на скачивание
Answer the question
In order to leave comments, you need to log in
Yandex began to block frequent requests from sites.
The solution was to include the head meta tag in the html heading:
This is so that your site does not transmit where the request for the picture or file comes from.
An alternative is not to specify globally as mentioned above, but to specify rel="noreferrer" for each link, as in the example below:
<meta name="referrer" content="no-referrer" />
<a href="http://example.com/" rel="noreferrer">ssilka</a>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question