コード例 #1
0
 public function login()
 {
     $responseData = Requests::get(self::$redirect_uri, null);
     $xmlData = $responseData->body;
     //<error>
     //<ret>0</ret>
     //<message>OK</message>
     //<skey>@crypt_7dd9baa8_b539032f0b7d2a56385e98018735aa39</skey>
     //<wxsid>1ya64xtGW2Aa7rmS</wxsid>
     //<wxuin>2432628783</wxuin>
     //<pass_ticket>njePr%2BqGGxpoiuX%2BBqnolnmUwwJar1YQBcBhHDowzLh1NWsev1%2BMXSWQtoXZBo7p</pass_ticket>
     //<isgrayscale>1</isgrayscale>
     //</error>
     $xml = simplexml_load_string($xmlData);
     $skeyArray = (array) $xml->skey;
     $wxsidArray = (array) $xml->wxsid;
     $pass_ticket = $xml->pass_ticket;
     self::$skey = $skeyArray[0];
     self::$wxsid = $wxsidArray[0];
     self::$wxuin = $xml->wxuin;
     self::$pass_ticket = $pass_ticket;
     if (self::$skey == '' && self::$skey == '' && self::$wxuin == '' && self::$pass_ticket == '') {
         return fasle;
     }
     self::$cookie = $responseData->cookies;
     self::$baseRequest['Uin'] = (int) self::$wxuin;
     self::$baseRequest['Sid'] = self::$wxsid;
     self::$baseRequest['Skey'] = self::$skey;
     self::$baseRequest['DeviceId'] = self::$deviceId;
     return true;
 }