javascript - 将这 5 行 JavaScript 代码转换为 cURL?

标签 javascript php curl

$.post("http://www.roblox.com/messages/send",{
                subject : "UMAD!",
                body : "UMAD!",
                recipientid : 2342342
})

我想知道如何将其转换为 cURL。

我需要发送 POST 请求。

我不知道从哪里开始。

有人可以帮忙吗?

最佳答案

$c = curl_init();
$curlConfig = array(
CURLOPT_URL            => "http://www.roblox.com/messages/send",
CURLOPT_POST           => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS     => array(
    'subject' => 'UMAD!',
    'body' => 'UMAD!',
    'recipientid' => '2342342',
)
);
curl_setopt_array($c, $curlConfig);
$result = curl_exec($c);
curl_close($c);

关于javascript - 将这 5 行 JavaScript 代码转换为 cURL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27577035/

相关文章:

php - MySQL 查询仅生成负日差异

php - 加载数据本地infile mysql服务器php Ubuntu

ubuntu - Curl:无法连接到 install.meteor.com 端口 443(AWS 服务器)

Bash 脚本,当我不希望 echo 换行时,它会换行

javascript - 加载 css 文件并覆盖之前的文件

javascript - Forge 查看器 API : Bounding box for a specific element

c# - 使用 Windows 通用应用程序将图像上传到 mysql 数据库

php - 如何使用 pkcs12 (p12) 证书发送到 Transunion API?

javascript - 使用 jQuery 防止 onclick Action

php - 无法使用 PHP $_POST 数组检索输入字段值