Answer the question
In order to leave comments, you need to log in
How to copy a file to Yandex Disk PHP REST API?
$from = '/X/photo/123.jpg';
$path = '/X/111/123.jpg';
$token = 'токен';
$curl2 = curl_init();
curl_setopt($curl2, CURLOPT_HTTPHEADER, array('Authorization: OAuth '.$token));
curl_setopt($curl2, CURLOPT_URL, 'https://cloud-api.yandex.net/v1/disk/resources/copy?from='.$from.'&path='.$path);
curl_setopt($curl2, CURLOPT_POST, true);
curl_setopt($curl2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl2, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($curl2);
curl_close($curl2);
curl_setopt($curl2, CURLOPT_POST, true);
writing: "the method is not supported." The copy request should be sent using the POST method.but somehow it doesn't work for me.
Answer the question
In order to leave comments, you need to log in
So tried https://tech.yandex.ru/disk/api/reference/create-f... ?
As always, I just wrote a post and immediately solved the problem!
just had to add:curl_setopt($curl, CURLOPT_POSTFIELDS, false);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question