php cUrl 通过 http post json数据
来源:互联网 发布:淘宝比价插件, 编辑:程序博客网 时间:2024/06/09 22:08
function http_post_data($url, $data_string) {$ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8','Content-Length: ' . strlen($data_string) ));ob_start();curl_exec($ch);$return_content = ob_get_contents();$return_content = mb_convert_encoding($return_content, "gb2312", "utf-8");//转换编码ob_end_clean();$return_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);return array($return_code, $return_content);}
使用
try {$url = "http://xxxx/xxxx/GetCommonPage"; $tableName=" Users.UserInfo ";$data = json_encode(array('fieldsName'=>"*",'tableName'=>$tableName, 'whereSql'=>" 1=1 ",'orderBy' =>"UserID asc",'startRowIndex'=>1,'maximumRows'=>10));list($return_code, $return_content) = http_post_data($url, $data);echo $return_content;} catch ( SoapFault $fault ) {echo "Error: ", $fault->faultcode, ", string: ", $fault->faultstring;}
- php cUrl 通过 http post json数据
- [php]通过http post发送json数据
- [php]通过http post发送json数据
- [php]通过http post发送json数据
- [php]通过http post发送json数据
- php通过curl post和get发送json数据实例 curl命令转为php源码
- PHP通过Http Post请求发送Json对象数据?
- php 利用curl通过post方式传递json
- 通过http post发送json数据
- php-curl(模拟post,设置header,接收json数据)
- PHP 通过curl post数据到 golang 的webserver
- php http post 方式有curl 、 file_get_content 、 fsocket ,来post提交数据
- php post json数据
- php curl post raw json参数
- php http post数据
- CURL模拟POST提交JSON数据
- curl perl python post发送json数据
- curl http post 数据和图片
- 暑期总结
- POJ2349+Prim
- poj 1470 Closest Common Ancestors(tarjan离线求lca)
- x264参数介绍(二、分析和视频可用性信息)
- ZOJ 1857 最短路
- php cUrl 通过 http post json数据
- printf 的宏定义版本
- Orcad网表到PADsPCB的转换问题
- pjsip代码分析(2)——register
- iOS中页面上移(要加委托UITextField/ViewDelegate)
- Win7下清除SQL SERVER 2008登录痕迹
- EditPlus文本编辑器使用心得
- ZOJ3582:Back to the Past(概率DP)
- The-M-Project 安装与配置