【IT专家】php 模拟登陆 获取用户列表 发消息
文科女生学啥专业好>包饺子的手法本文由我司收集整编,推荐下载,如有疑问,请与我司联系php 模拟登陆获取用户列表发消息2015/04/16 0  ?phpheader( Content-Type: text/html; charset=UTF-8 /*调用方式简单说明:$arr = array( account = 公众平台帐号, password = 密码);$w = new Weixin($arr);print_r($w- getAllUserInfo());//获取所有用户信息$w- getUserInfo($groupid, $fakeid);//获取所有用户信息,如果默认分组,则$groupid传0$w- sendMessage( 发内容//发给所有用户$w- sendMessage( 发内容,$userId); //发给特定用户,这里的$userId就是用户的fakeid,数组方式传递*/class Weixin { public $userFakeid;//所有粉丝的fakeid private $_account;//用户名private $_password;//密码private $url;//请求的网址private $send_data;//提交的数据private $getHeader = 0;//是否显示Header信息private $token;//公共帐号TOKEN private $host = mp.weixin.qq //主机private $origin = mp.weixin.qq  private $referer;//引用地址private $cookie; private $pageSize = 100000;//每页用户数(用于读取所有用户)private $userAgent = Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0    public function __construct($options){ $this- _account = isset($options[ account ])?$options[ account ]:  $this- _password = isset($options[ password ])?$options[ password ]:  $this- login(); }  //登录private function login(){ $url = mp.weixin.qq/cgi-bin/login?lang=zh_CN  $this- send_data = array( username = $this- _account, pwd = md5($this- _password), f = json  ); $this- referer = mp.weixin.qq/  $this- getHeader = 1; $result = explode( \n ,$this- curlPost($url)); foreach ($result as $key = $value) { $value = trim($value);  if (preg_match( /token=(\d+)/i , $value,$match)) { //获取token $this- token = trim($matc杭州的大学有哪些
h[1]); }  if (preg_match( / ret :(.*)/i , $value,$match)){//获取token switch ($match[1]) { case -1: die(json_encode(array( status = 1, errCode = $match[1], msg = 系统错误))); case -2: die(json_encode(array( status = 1, errCode = $match[1], msg = 帐号或密码错误))); case -3: die(urldecode(json_encode(array( status = 1, errCode = $match[1], msg = urlencode( 密码错误))))); case -4: die(json_encode(array( status = 1, errCode = $match[1], msg =
>初六拜年祝福语>音乐家的作品

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。