【发布时间】:2015-08-26 09:34:06
【问题描述】:
您好,我正在尝试使用 PHP 和 Curl 发送 POST 请求。我想发送一个类似这样的JSON
"json":{
"testString":"test",
"testInt":1
}
我已经尝试过这段代码来完成这个
curl_init("domain.com");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, '"json":'.$data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch);
收到请求的我的 laravel 项目没有得到任何信息。
编辑:进一步解释,我的 laravel 项目收到了请求,但没有附加发布数据,没有。
【问题讨论】:
标签: php json laravel post curl