今天就跟大家聊聊有关利用php怎么实现一个微信公众号无限群发功能,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
创新互联建站专注为客户提供全方位的互联网综合服务,包含不限于网站设计制作、网站建设、永川网络推广、成都小程序开发、永川网络营销、永川企业策划、永川品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们大的嘉奖;创新互联建站为所有大学生创业者提供永川建站搭建服务,24小时服务热线:18982081108,官方网址:www.cdcxhl.comsendAllMsg.php
appId = $appId; $this->appSecret = $appSecret; $this->access_token = $this->getAccessToken(); } // function getData($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)'); curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $data = curl_exec($ch); curl_close($ch); return $data; } // function postData($url,$data){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $tmpInfo = curl_exec($ch); if (curl_errno($ch)) { return curl_error($ch); } curl_close($ch); return $tmpInfo; } // function getAccessToken(){ $url = "/tupian/20230522/token $res = $this->getData($url); $jres = json_decode($res,true); $access_token = $jres['access_token']; return $access_token; } // private function getUserInfo(){ $url = "/tupian/20230522/get $res = $this->getData($url); $jres = json_decode($res,true); //print_r($jres); $userInfoList = $jres['data']['openid']; return $userInfoList; } function sendMsgToAll(){ $userInfoList = $this->getUserInfo(); $url = "/tupian/20230522/send foreach($userInfoList as $val){ $data = '{ "touser":"'.$val.'", "msgtype":"text", "text": { "content":"测试一下,抱歉打扰各位" } }'; $this->postData($url,$data); } } } $test = new SendAllMsg("YOURappId","YOURappSecret"); $test->sendMsgToall(); ?>
看完上述内容,你们对利用php怎么实现一个微信公众号无限群发功能有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联行业资讯频道,感谢大家的支持。