1
我有簡單的PHP腳本。殼牌捲毛請求
$url = 'http://test.com/api/images/products/33';
$image_path = '/srv/images/some.jpg';
$key = 'qwerty';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
//curl_setopt($ch, CURLOPT_PUT, true); // Un-commet to edit an image
curl_setopt($ch, CURLOPT_USERPWD, $key.':');
curl_setopt($ch, CURLOPT_POSTFIELDS, array('image' => '@'.$image_path));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
該腳本運行良好。我想將此代碼轉換爲簡單的curl shell命令。
我試圖
curl -v -X POST -d [email protected]/srv/images/some.jpg \
http://[email protected]/api/images/products/33
但錯誤發生。哪裏不對?
'/路徑/到/ PHP /路徑/到/你/ script.php' ;-) –
「但發生錯誤」 - **什麼**錯誤? – Quentin