Php Curl上传不适用于ge.tt API
大家好,我正在尝试使用本教程上传。在第4步中,他们提到了类似的内容Php Curl上传不适用于ge.tt API,php,curl,Php,Curl,大家好,我正在尝试使用本教程上传。在第4步中,他们提到了类似的内容 curl --upload-file myfile.txt http://blobs.ge.tt/a1b2c3/myfile.txt?sig=-TR2k2-3kjsh9nfmn4 上面这一行的等效php代码是什么?我尝试了下面的代码,但不起作用(返回bool false) 注意:我得到了正确的$url,并且myfile.txt存在,我尝试将'file'=>'@/home/nextgen/public_html/api/my
curl --upload-file myfile.txt http://blobs.ge.tt/a1b2c3/myfile.txt?sig=-TR2k2-3kjsh9nfmn4
上面这一行的等效php代码是什么?我尝试了下面的代码,但不起作用(返回bool false)
注意:我得到了正确的$url,并且myfile.txt存在,我尝试将'file'=>'@/home/nextgen/public_html/api/myfile.txt'替换为'@myfile.txt'。似乎什么都不起作用。如果使用curl的-选项,您会看到区别。您的命令行执行PUT,您的PHP版本执行多部分formpost
你什么意思?就像希腊语和拉丁语你能再解释一下吗
$url = $arr["posturl"];
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$postData = array(
'file' => '@/home/nextgen/public_html/api/myfile.txt',
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$response = curl_exec($ch);
var_dump($response);