curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
Note:
传递一个数组到CURLOPT_POSTFIELDS,cURL会把数据编码成 multipart/form-data,而然传递一个URL-encoded字符串时,数据会被编码成 application/x-www-form-urlencoded。
linux
curl
get方法请求,curl "http://blog.youkuaiyun.com/alanwei04/article/details/79313029"
post方法请求,curl -d "param1=value1¶m2=value2" "http://xxxx.xxx"