curl CURLOPT_INFILE

时间:2017-10-03 07:38:19

标签: php curl fopen

不幸的是,我的服务器已被禁止fopen()。我可以用什么呢? 这是我的剧本:

$fp = fopen($path, 'r');  
$ch = curl_init('https://content.dropboxapi.com/2/files/upload');
curl_setopt($ch, CURLOPT_HTTPHEADER, $cheaders);
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
$contents = utf8_encode($server_output);
$results = json_decode($contents);
curl_close($ch);

0 个答案:

没有答案