PHP 来自 Amazon S3 流包装器(tcp 流)的 CURL PUT

PHP CURL PUT from Amazon S3 stream wrapper (tcp stream)

我正在尝试 (PHP) 使用 S3 流包装器 (s3://...) 将文件从 Amazon S3 卷曲 PUT 到 Vimeo 并收到以下错误:

curl_setopt_array(): cannot represent a stream of type tcp_socket/ssl as a STDIO FILE in [...]

有没有办法 cURL PUT 远程文件?这是发送的卷曲选项:

$curl_opts = array(
  CURLOPT_PUT => true,
  CURLOPT_INFILE => $file, // this refers to 's3://path-to-object'
  CURLOPT_INFILESIZE => $size,
  CURLOPT_UPLOAD => true,
  CURLOPT_HTTPHEADER => array('Expect: ', 'Content-Range: replaced...')
);

在 PUT 之前将文件保存到本地服务器:

$file = tempnam(sys_get_temp_dir(), "foo");
$data = file_get_contents("s3://path-to-object");
$size = strlen($data);
file_put_contents($file, $data);
$curl_opts = array(
  CURLOPT_PUT => true,
  CURLOPT_INFILE => $file, // this refers to 's3://path-to-object'
  CURLOPT_INFILESIZE => $size,
  CURLOPT_UPLOAD => true,
  CURLOPT_HTTPHEADER => array('Expect: ', 'Content-Range: replaced...')
);