【问题标题】:Converting Linux Curl Command to PHP将 Linux Curl 命令转换为 PHP
【发布时间】:2016-02-03 09:18:59
【问题描述】:

我想知道,如何将 linux curl 命令转换为 PHP。这是我的 linux curl 命令。提前致谢。

curl -i -F api_password=<YOUR_API_PASSWORD> -F file=@<LOCAL_FILE_PATH> https://upload.wistia.com/

【问题讨论】:

标签: php linux curl


【解决方案1】:

这里是你可以使用的起点……

<?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);
?>

【讨论】:

    猜你喜欢
    • 2019-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-01
    • 1970-01-01
    • 2021-03-28
    相关资源
    最近更新 更多