2016-02-03 142 views
-2

我想知道,如何將linux curl命令轉換爲PHP。這是我的linux捲曲命令。提前致謝。將Linux Curl命令轉換爲PHP

curl -i -F api_password=<YOUR_API_PASSWORD> -F [email protected]<LOCAL_FILE_PATH> https://upload.wistia.com/ 
+1

你有沒有嘗試過的東西,什麼? – Oxi

+1

不要浪費你的時間,我們爲你編寫php代碼,從http://php.net/manual/en/curl.examples-basic.php開始,然後嘗試你的自我,如果有任何問題,告訴我們。 –

回答

0

這裏是你可以使用的出發點...

<?php 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_HEADER, true); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_URL, $THE_REMOTE_URL_YOU_ARE_POSTING_TO); 
curl_setopt($ch, CURLOPT_POST, true); 
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
    "file" => "@c:\\file_location.txt", // note the double \\ when used within double quotes 
    'api_password' => 12345 
)); 
$response = curl_exec($ch); 
?> 
+0

感謝它的魅力 –