PHP http(file_get_content) GET与POST请求方式
来源:互联网 发布:国家卫生部数据查询 编辑:程序博客网 时间:2024/04/29 15:38
转自:http://blog.csdn.net/chaoping315/article/details/19013237
1.GET方式请求
- <?php
- $data = array('sParam1'=>'test1','sParam2'=>101,'isAuto'=>1); //定义参数
- $data = @http_build_query($data); //把参数转换成URL数据
- $aContext = array('http' => array('method' => 'GET',
- 'header' => 'Content-type: application/x-www-form-urlencoded',
- 'content' => $data ));
- $cxContext = stream_context_create($aContext);
- $sUrl = 'http://www.mytest.com/test.php'; //此处必须为完整路径
- $d = @file_get_contents($sUrl,false,$cxContext);
- print_r($d);
- ?>
2.POST方式请求
- <?php
- $data = array('sParam1'=>'test1','sParam2'=>101,'isAuto'=>1); //定义参数
- $data = @http_build_query($data); //把参数转换成URL数据
- $aContext = array('http' => array('method' => 'POST',
- 'header' => 'Content-type: application/x-www-form-urlencoded',
- 'content' => $data ));
- $cxContext = stream_context_create($aContext);
- $sUrl = 'http://www.mytest.com/test.php'; //此处必须为完整路径
- $d = @file_get_contents($sUrl,false,$cxContext);
- print_r($d);
- ?>
0 0
- PHP http(file_get_content) GET与POST请求方式
- PHP http(file_get_content) GET与POST请求方式
- PHP请求http(file_get_content)
- HTTP请求方式:get与post
- http请求 get post 方式
- php http post get 请求
- php http post 方式有curl 、 file_get_content 、 fsocket ,来post提交数据
- HTTP请求的GET与POST方式的区别
- Http请求的GET与POST方式的区别
- HTTP请求的GET与POST方式的区别
- HTTP请求的GET与POST方式的区别
- HTTP请求的GET与POST方式的区别
- HTTP请求的GET与POST方式的区别
- HTTP请求的GET与POST方式的区别
- HTTP请求的GET与POST 方式的区别
- HTTP中的GET请求与POST请求
- HTTP中的get请求与post请求
- http请求方式分析(get, post)
- ant maven gradle
- Android APP安装后不在桌面显示图标的应用场景举例和实现方法
- 图片链接。
- 数据排序方法的比较
- 《C# in Depth:深入理解C#》读书笔记 - 方法组转换和匿名方法
- PHP http(file_get_content) GET与POST请求方式
- 行业发展(百度、阿里、腾讯)
- java排序
- python中requests使用代理proxies
- Android 性能优化注意事项
- ubuntu14.04与win7相互共享
- 如何生成keystore
- shell脚本tr
- 数据通信基本原理学习