php curl post方式访问网页
curl post方式访问网页 [代码片段(19行)]
$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;
- 上一篇:php 二分查找PHP实现
- 下一篇:PHP获取内存使用信息
精彩图集
精彩文章