php - 将 Linux Curl 命令转换为 PHP

标签 php linux curl

我想知道如何将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/

相关文章:

linux - 使用 Lauterbach T32 和 Linux/Qt 时 CPU 使用率较高

c - 内存管理和内存分配之间的区别。当分配/访问发生时它们都一起工作2内存|它们是如何精确相关的

c - 虚拟内存中的两个进程

cURL 与 NSS - 找不到证书

php - 根据条件连接不同的表

php - Xml 中的非法字符

php - 使用 unix 权限等属性组合传递变量的最佳方式

php - 如何用php自动创建页面? (更多细节在里面)

curl - 我需要删除curl中的cluster.routing.allocation.awareness.force

php - xml php curl 请求不支持的媒体类型