if(!function_exists('tps_curl_post3')){
function tps_curl_post3($url, $postData) {
$postData = json_encode($postData);
$curl = curl_init(); //初始化
curl_setopt($curl,CURLOPT_URL,$url); //设置url
curl_setopt($curl,CURLOPT_HTTPAUTH,CURLAUTH_BASIC); //设置http验证方法
curl_setopt($curl, CURLOPT_TIMEOUT,30);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); //设置curl_exec获取的信息的返回方式
curl_setopt($curl,CURLOPT_POST,1); //设置发送方式为post请求
curl_setopt($curl,CURLOPT_POSTFIELDS,$postData); //设置post的数据 curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($postData))
); $result = curl_exec($curl);
curl_close($curl);
return json_decode($result,true);
}
}

最新文章

  1. iOS之 Xcode7下 bitcode的工作流程及安全评估
  2. C#方法的六种参数,值参数、引用参数、输出参数、参数数组、命名参数、可选参数
  3. 【JAVA、C++】LeetCode 013 Roman to Integer
  4. Android -- Support包特性
  5. 【转】Newtonsoft.Json 的序列化与反序列化
  6. App是什么,可以分为几类?及其相关解释。
  7. (Step by Step)How to setup IP Phone Server(VoIP Server) for free.
  8. HDU5437 Alisha’s Party (优先队列 + 模拟)
  9. 深度分析 Java 的 ClassLoader 机制(源码级别)(转)
  10. Codeforces 383C . Propagating tree【树阵,dfs】
  11. (@WhiteTaken)设计模式学习——抽象工厂模式
  12. jQuery选择器的分类之过滤选择器
  13. STL中队列(queue)的使用方法
  14. Python 爬虫练习(三) 利用百度进行子域名收集
  15. android 开发之 ListView 与Adapter 应用实践
  16. vue中import引入模块路径中@符号是什么意思
  17. Xilinx FPGA开发随笔
  18. IDEA 不识别的MAVEN 项目应如何处理
  19. Python全栈之路----数据类型—列表
  20. Codeforces 750E New Year and Old Subsequence - 线段树 - 动态规划

热门文章

  1. jsp之获传统方式取后台数据
  2. HTTP、HTTP2.0、HTTPS、SPDY
  3. PropertyConfigurer.java
  4. 剑指offer题目分类
  5. 最大长度回文子串(Manacher's algorithm)
  6. C#动态数组ArrayList
  7. C++ 学习笔记(一) cout 与printf 的不同之处
  8. 常用的windows小工具指令和如何打开自定义的程序
  9. read design into DC memory
  10. percpu之静态变量