C
C
classinfo2017-01-28 19:27:37
Yandex.Disk
classinfo, 2017-01-28 19:27:37

Uploading files to Yandex Disk REST API?

Uploading files to Yandex Disk REST API
$url = " https://cloud-api.yandex.net/v1/disk/resources/upl... ";
// https://cloud-api.yandex.net/v1/disk/resources?pat... "
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$header = array(
'Accept : application/json',
'Authorization: OAuth '.TOKEN ,
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
How to organize a check if the file is on the server or is it possible to overwrite if it already exists?*

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Taratin, 2017-01-28
@classinfo

Get file or directory properties
https://tech.yandex.ru/disk/doc/dg/reference/propf...
There is a ready client for php
https://github.com/nixsolutions/yandex-php-library...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question