zoukankan      html  css  js  c++  java
  • 获取微信Token值

        /**
         * 获取Token值
         * @param $corpid
         * @param $corpsecret
         * @return mixed
         * @author 宁佳兵 <meilijing.ning@foxmail.com>
         */
        function getToken($corpid,$corpsecret){
            $url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=".$corpid."&corpsecret=".$corpsecret."";
            $access_token = httpUrl($url);
            return $access_token;
            
        }
        
        /**
         * 远程调用url
         * @param $url
         * @param null $data
         * @return mixed
         * @author 宁佳兵 <meilijing.ning@foxmail.com>
         */
        function httpUrl($url,$data = null){
            $ch = curl_init ();
            curl_setopt ( $ch, CURLOPT_URL, $url );
            curl_setopt ( $ch, CURLOPT_POST, 1 );
            curl_setopt ( $ch, CURLOPT_HEADER, 0 );
            curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
            curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
            $result = curl_exec ( $ch );
            curl_close ( $ch );
            $arr=json_decode($result, true);
            return $arr;
        }
  • 相关阅读:
    取随机数
    端口号
    cut命令
    渗透
    ssh免密登陆
    漏洞扫描
    信息收集1:DNSEUM命令
    Centos6与Centos7的区别
    HAPROXY+KEEPALIVED实现负载均衡
    this的用法
  • 原文地址:https://www.cnblogs.com/ningjiabing/p/10243179.html
Copyright © 2011-2022 走看看