|
@@ -618,14 +618,22 @@ class Wechatext
|
|
|
$cookie = '';
|
|
|
$this->log($snoopy->results);
|
|
|
$result = json_decode($snoopy->results,true);
|
|
|
- if ($result['ErrCode']!=0) return false;
|
|
|
+
|
|
|
+ if (!isset($result['base_resp'])) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($result['base_resp']['ret'] != 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
foreach ($snoopy->headers as $key => $value) {
|
|
|
$value = trim($value);
|
|
|
if(preg_match('/^set-cookie:[\s]+([^=]+)=([^;]+)/i', $value,$match))
|
|
|
$cookie .=$match[1].'='.$match[2].'; ';
|
|
|
}
|
|
|
|
|
|
- preg_match("/token=(\d+)/i",$result['ErrMsg'],$matches);
|
|
|
+ preg_match("/token=(\d+)/i",$result['redirect_url'],$matches);
|
|
|
if($matches){
|
|
|
$this->_token = $matches[1];
|
|
|
$this->log('token:'.$this->_token);
|