M
M
Murad Jelilov2014-07-19 11:57:50
PHP
Murad Jelilov, 2014-07-19 11:57:50

How to correctly issue links for downloading files from Yandex disk using api?

Wrote a script for issuing links to download files from Yandex disk.

$headers = array("Authorization: OAuth 09.......2f.................322f");
$curl = curl_init('https://cloud-api.yandex.net/v1/disk/resources/download?path=/myfile');
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$link = curl_exec($curl);
curl_close($curl);
$link = json_decode($link, true);

When I am authorized to Yandex from the account through which I received the OAuth token, there are no problems with downloading files. When you log out of your account and try to download, it redirects you to a non-existent page.
Tell me what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Zelenin, 2014-07-19
@zelenin

api.yandex.ru/disk/api/reference/content.xml
read the documentation, right? what is not clear about it?

V
Vlad Zhivotnev, 2014-07-19
@inkvizitor68sl

Because through the API you get links that are not for public download.

M
Murad Jelilov, 2014-07-24
@dmuradz

@inkvizitor68sl is it possible to give public download links?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question