您好,欢迎访问一九零五行业门户网

获取sina邮箱联系人列表失败,

获取sina邮箱联系人列表失败,求救!!!
php codehost = $matches[1]; return 1; } function getcontacts( $user, $password, &$result ) { if ( !$this->checklogin( $user, $password ) ) { return '登陆失败'; } $ch = curl_init( ); curl_setopt( $ch, curlopt_header, true ); curl_setopt( $ch, curlopt_returntransfer, true ); curl_setopt( $ch, curlopt_followlocation, true ); curl_setopt( $ch, curlopt_useragent, useragent ); curl_setopt( $ch, curlopt_cookiejar, cookiejar ); curl_setopt( $ch, curlopt_timeout, timeout ); curl_setopt( $ch, curlopt_url, http://mail.sina.com.cn/cgi-bin/login.cgi ); curl_setopt( $ch, curlopt_post, true ); curl_setopt( $ch, curlopt_postfields, &logintype=uid&u=.urlencode( $user ).&psw=.$password ); curl_exec( $ch ); curl_close( $ch ); $cookies = array( ); $bret = $this->readcookies( cookiejar, $cookies ); if ( !$bret && !$cookies['swebappsessid'] ) { return '读取cookie失败'; } $ch = curl_init( ); curl_setopt( $ch, curlopt_cookiefile, cookiejar ); curl_setopt( $ch, curlopt_returntransfer, true ); curl_setopt( $ch, curlopt_timeout, timeout ); curl_setopt( $ch, curlopt_url, $this->host./classic/addr_member.php ); curl_setopt( $ch, curlopt_post, true ); curl_setopt( $ch, curlopt_postfields, &act=list&sort_item=letter&sort_type=desc ); $content = curl_exec( $ch ); curl_close( $ch ); $bret = $this->_parsedata( $content, $result ); return 结果:.$bret; } function readcookies( $file, &$result ) { $fp = fopen( $file, r ); while ( !feof( $fp ) ) { $buffer = fgets( $fp, 4096 ); $tmp = split( \t, $buffer ); $result[trim( $tmp[5] )] = trim( $tmp[6] ); } return 1; } function _parsedata( $content, &$ar ) { $ar = array( ); if ( !$content ) { return '获取内容为空'; } $data = json_decode( $content ); unset( $content ); foreach ( $data->data->contact as $value ) { if ( preg_match_all( /[a-z0-9_\\.\\-]+@[a-z0-9\\-]+\\.[a-z]{2,6}/i, $value->email, $matches ) ) { $emails = array_unique( $matches[0] ); unset( $matches ); foreach ( $emails as $email ) { $ar[$email] = $value->name; } } } return $ar; }}$contactssina = new contactssina;$res = $contactssina->getcontacts('****@sina.com','***',$result);print_r($res);?>

其它类似信息

推荐信息