zoukankan      html  css  js  c++  java
  • curl 模拟请求get/post

    $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx24a0ef05af955bdd&secret=f721b4d068d74a8a37817707a7cf316b";
    //支持post/get只需修改参数get/post
    function https_request($url,$data = null,$method="POST")
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);//// 跳过证书检查 

        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); // 从证书中检查SSL加密算法是否存在 

        if (!empty($data)){
            curl_setopt($curl, CURLOPT_POST, 1);
            curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
        }
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        $output = curl_exec($curl);
        curl_close($curl);
        return $output;
    }

  • 相关阅读:
    设计模式之中介者模式
    解释器模式(行为模式)
    进程池Pool
    Process子类
    multiprocessing
    random
    re
    time和datetime
    logging 日志
    hashlib
  • 原文地址:https://www.cnblogs.com/lixiansen/p/5655294.html
Copyright © 2011-2022 走看看