function getHtmlToKen($user) { $http = new http_curl(); $http->from = "http://www.yiban.cn/"; $loginUrl = "http://www.yiban.cn/"; $http->file = md5($user) . '.cookie'; $re = $http->get($loginUrl, $this->headerArray); preg_match_all("/g_config.token =.?\"(.*)\";/iU", $re[1], $token); //获取token return $token[1][0]; }
function getFrends($user, $page = 1) { $http = new http_curl(); $http->from = "http://www.yiban.cn/user/friend/list"; $loginUrl = "http://www.yiban.cn/user/friend/list/page/" . $page; $http->file = md5($user) . '.cookie'; $re = $http->get($loginUrl, $this->headerArray); $html = empty($re[1]) ? 0 : $re[1]; $newArray = array(); $AllArray = array(); if (preg_match("/data-userid/iU", $html)) { preg_match_all("/data-userid=\"(.*)\"/iU", $re[1], $YBid); preg_match_all("/<span class=\"name\">(.*)<\\/span>/iU", $re[1], $YBname); unset($YBid[0]); unset($YBname[0]); $newArray[] = $YBid[1]; $newArray[] = $YBname[1]; // print_r($newArray); $AllArray[$page] = $newArray; $page++; $nre = $this->getFrends($user, $page); if ($nre != 'null') { $AllArray[$page] = $nre[$page]; } } else { return 'null'; } return $AllArray; }