我想知道如何将linux的curl命令转换为PHP。这是我的 linux curl 命令。提前致谢。
curl -i -F api_password=<YOUR_API_PASSWORD> -F file=@<LOCAL_FILE_PATH> https://upload.wistia.com/
最佳答案
这是您可以使用的起点...
<?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);
?>
关于php - 将 Linux Curl 命令转换为 PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35172863/