コード例 #1
0
 public function weChatInitial()
 {
     //print_r(self::$baseRequest);
     $url = sprintf(self::$base_uri . '/webwxinit?pass_ticket=%s&skey=%s&r=%s', self::$pass_ticket, self::$skey, time());
     $params = array('BaseRequest' => self::$baseRequest);
     $responseData = Requests::post($url, array('ContentType' => 'application/json; charset=UTF-8'), json_encode($params));
     $dictionary = json_decode($responseData->body, 1);
     //print_r($dictionary);
     self::$contactList = $dictionary['ContactList'];
     self::$my = $dictionary['User'];
     $errorMsg = $dictionary['BaseResponse']['ErrMsg'];
     if (strlen($errorMsg) > 0) {
         echo $errorMsg;
     }
     $ret = $dictionary['BaseResponse']['Ret'];
     if ($ret != 0) {
         return fasle;
     }
     return true;
 }