- $url = http://xxxx.com;
- $params = array('id'=>11,'aa'=>22,'cc'=>33);
- $data = http_build_query($params);
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- if('' != $data){
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
- }
- curl_setopt($ch, CURLOPT_TIMEOUT, 6);
- $result = curl_exec($ch);
- var_dump(curl_error($ch));
- curl_close($ch);
- return $result;
来源: http://www.phpxs.com/code/1003513/