function getImgData($fakeid) { $mmc = memcache_init(); self::$cookie = memcache_get($mmc, "daShanLoginCookie"); self::$token = memcache_get($mmc, "daShanLoginToken"); if (empty(self::$cookie)) { $this->cookie(); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://mp.weixin.qq.com/misc/getheadimg?fakeid={$fakeid}&token=" . self::$token . "&lang=zh_CN"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_COOKIE, self::$cookie); curl_setopt($ch, CURLOPT_REFERER, 'https://mp.weixin.qq.com/cgi-bin/message?t=message/list&token=' . self::$token . '&count=20&day=7'); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0'); $ret = curl_exec($ch); curl_close($ch); return $ret; }
<?php //$mmc = memcache_init (); //echo memcache_delete ( $mmc, "osvGYs1WtZscimcOYeQK3HW6skZ4dashan" ); require_once 'DaShan.class.php'; $daShan = new DaShan(); $daShan->username = "******"; $daShan->password = "******"; $daShan->cookie(); header('Content-Type:image/jpg'); $a = $daShan->getImgData('1747156981'); echo $a; //echo memcache_set ( $mmc, "test",$a, 0, 300); //var_dump($daShan->getUserInfo('964862461')); //echo $daShan->getUserFakeid(42);