|
@@ -602,7 +602,7 @@ class Wechatext
|
|
|
*/
|
|
|
public function login(){
|
|
|
$snoopy = new Snoopy;
|
|
|
- $submit = "http://mp.weixin.qq.com/cgi-bin/login?lang=zh_CN";
|
|
|
+ $submit = "https://mp.weixin.qq.com/cgi-bin/login?lang=zh_CN";
|
|
|
$post["username"] = $this->_account;
|
|
|
$post["pwd"] = md5($this->_password);
|
|
|
$post["f"] = "json";
|
|
@@ -612,7 +612,11 @@ class Wechatext
|
|
|
$cookie = '';
|
|
|
$this->log($snoopy->results);
|
|
|
$result = json_decode($snoopy->results,true);
|
|
|
- if ($result['base_resp']['err_msg']!='ok') return false;
|
|
|
+
|
|
|
+ if (!isset($result['base_resp']) || $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))
|