0
framework - fuelphp 1.7Fuelphp rest PUT issue
Я пытаюсь загрузить файл с сервера на другой.
отправить i использовать завиток.
$url = "http://files.loc/api/upload";
$body = 'data that I want to send';
$fp = fopen('php://temp/maxmemory:256000', 'w');
if (!$fp) {
die('could not open temp memory data');
}
fwrite($fp, $body);
fseek($fp, 0);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PUT, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_INFILESIZE, strlen($body));
$output = curl_exec($ch);
curl_close($ch);
приема данных на другой сервер выглядит
class Controller_Api_Upload extends Controller_Rest {
public function put_index()
{
$content = file_get_contents("php://input");
$file = fopen('./images/txt.txt', 'w+');
fwrite($file, $content);
fclose($file);
}
}
У меня есть 403 Ошибка "Доступ запрещен!". что я делаю неправильно?