function curlBy($url, $data=array()) {
        $ch = curl_init();
        if(!empty($data)){
            if (is_array($data) && $data) {
                $formdata = http_build_query($data);
                curl_setopt($ch, CURLOPT_POST, true);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $formdata);
            }
        }
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_TIMEOUT,0);
        $result = curl_exec($ch);
        return $result;
    }

注:post的参数以数组形式传到curlBy函数的第二个参数

最新文章

  1. js事件(Event)知识整理
  2. koa知识点
  3. 【分布式协调器】Paxos的工程实现-cocklebur选举
  4. 3_mysql 主从复制
  5. Swift开发学习-03 Swift技巧
  6. ZOJ题目分类
  7. tq2440开发板基本配置
  8. silverlight控件动画状态的过渡
  9. HDU 4727 The Number Off of FFF
  10. 倒叙筛除list
  11. 使用AngularJS的三个重要原因
  12. (23)IO之打印流 PrintStream & Printwriter
  13. java课程设计——猜数游戏个人博客
  14. jQuery-day01-介绍 和 选择器获取元素
  15. php utf8编码字符串的截取
  16. django 初始命令
  17. Go Example--通道遍历
  18. 手机调试 fiddler
  19. Pipeline 与 xargs
  20. ajax访问当前页面后的 [WebMethod]描述的方法

热门文章

  1. JAVA错误:Cannot refer to a non-final variable * inside an inner class defined in a different method
  2. js 倒计时(转)
  3. [SQL]根据刚刚插入数据的 ID 向另外一张表插入数据(插入的其他字段数据需要对字符串进行分析)
  4. Android--输入自动提示AutoCompleteTextView
  5. (转).NET代码混淆实践
  6. chinapay
  7. OpenGL的学习与认识
  8. 如何隐藏storyboard中的top bar
  9. Redis附加功能之Redis流水线pipeline
  10. The Ninth Hunan Collegiate Programming Contest (2013) Problem J