PHP的CURL的POST/GET访问
来源:互联网 发布:coc2017城墙升级数据 编辑:程序博客网 时间:2024/05/28 17:05
本文出至:新太潮流网络博客
/** * [curl以GET的方式访问] * @E-mial wuliqiang_aa@163.com * @TIME 2017-04-07 * @WEB http://blog.iinu.com.cn * @param [data] $url [访问的路径] * @param string $data [description] * @return [type] [description] */function curlGet($url,$data=''){ $ch = curl_init(); $header = "Accept-Charset: utf-8"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $temp = curl_exec($ch); return $temp;}/** * [curl以POST的方式访问] * @E-mial wuliqiang_aa@163.com * @TIME 2017-04-07 * @WEB http://blog.iinu.com.cn * @param [data] $url [访问的路径] * @param [type] $data [description] * @return [type] [description] */function curlPost($url, $data){ $ch = curl_init(); $header = "Accept-Charset: utf-8"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $tmpInfo = curl_exec($ch); if (curl_errno($ch)) { return false; }else{ return true; }}本文出至:新太潮流网络博客
阅读全文
0 0
- PHP的CURL的POST/GET访问
- php的curl实现get和post
- php的curl实现get和post
- php的curl实现get和post
- php curl (get post)
- php curl post get
- PHP的curl实现get,post 和 cookie
- php curl实现get和post的代码
- PHP curl的get、post类及实例
- PHP curl的用法(get and post)
- php通过curl实现的POST和GET请求
- php封装curl的post和get类
- 调整版PHP的CURL类(POST、GET、PUT、DELETE)
- PHP----curl默默http的get跟post请求
- php curl 发送GET,POST请求的函数
- c++ curl get 访问网页(post关于curl 的文章都有就不介绍了)
- c++ curl get 访问网页(post关于curl 的文章都有就不介绍了)
- PHP 5.6 的Curl POST
- Eclipse反编译插件JadClipse打包离线安装
- 关于<c:if >判断 char 类型
- xstream解析xml字符串和生成对象
- Andrew Ng机器学习笔记(三)
- WINAPI--解压缩函数
- PHP的CURL的POST/GET访问
- 查看临时表空间及大小
- Postman相关
- Spark快速入门指南 – Spark安装与基础使用
- 网络钓鱼大讲堂 Part5 | 网络钓鱼对策(反钓鱼)
- PHP检测数组中的每个值是否含有特殊字符
- VS2012 C++ thrift-0.10.0简单使用示例
- windows注册表修改大全
- 动画[5]PropertyAnimator AnimatorSet