嗨,我有以下要求api。
发送这样的帖子数据:
data[email] : test@test.com
data[firstName] :first
data[lastName] : last
data[country] :DE
如何通过卷曲发送?
答案 0 :(得分:-1)
请参阅此答案:How do I use arrays in cURL POST requests
如果你已经拥有数组$ data:
$field_string = http_build_query($data);
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
...