Currently, everyone is using QQ, and also uses some other software that comes with QQ as their daily tools. Today we will introduce to you how to use . The specific PHP code to get QQ mailbox friends is as follows: How about
<ol class="dp-xml"> <li class="alt"> <span><strong><font color="#006699"><span class="tag"><?</SPAN><SPAN class=tag-name>php</SPAN></FONT></STRONG><SPAN> </SPAN></SPAN><LI class=""><SPAN>/** </SPAN><LI class=alt><SPAN>* @file class.qqhttp.php </SPAN><LI class=""><SPAN>* qq邮箱登陆获取类 </SPAN><LI class=alt><SPAN>* @author wc</SPAN><STRONG><FONT color=#006699><SPAN class=tag><</SPAN><SPAN class=tag-name>cao8222</SPAN></FONT></STRONG><SPAN>@gmail.com</SPAN><SPAN class=tag><STRONG><FONT color=#006699>></span></font></strong></span><span> </span> </li> <li class=""><span>* @date 2009-04-27 </span></li> <li class="alt"><span> */ </span></li> <li class=""><span> </span></li> <li class="alt"><span>class QQHttp { </span></li> <li class=""><span> </span></li> <li class="alt"> <span> var $</span><span class="attribute"><font color="#ff0000">cookie</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">''</font></span><span>; </span> </li> <li class=""><span> </span></li> <li class="alt"><span> function __cunstrut() { </span></li> <li class=""><span> } </span></li> <li class="alt"><span> </span></li> <li class=""><span> function makeForm() { </span></li> <li class="alt"> <span> $</span><span class="attribute"><font color="#ff0000">form</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">array</font></span><span>( </span> </li> <li class=""> <span> 'url' =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> "http://mail.qq.com/cgi-bin/loginpage", </span> </li> <li class="alt"><span> ); </span></li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">data</font></span><span> = $this-</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>curlFunc($form); </span> </li> <li class="alt"> <span> preg_match('/</span><span class="attribute"><font color="#ff0000">name</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">"ts"</font></span><span></span><span class="attribute"><font color="#ff0000">svalue</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">"(d+)"</font></span><span>/',$data['html'], $tspre); </span> </li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">ts</font></span><span> = $tspre[1]; </span> </li> <li class="alt"> <span> preg_match('/</span><span class="attribute"><font color="#ff0000">action</font></span><span>="http://(md+).mail.qq.com/',$data['html'], $server); </span> </li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">server_no</font></span><span> = $server[1]; </span> </li> <li class="alt"><span> </span></li> <li class=""><span> /* login.html 载入 */ </span></li> <li class="alt"> <span> $</span><span class="attribute"><font color="#ff0000">html</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">file_get_contents</font></span><span>(dirname(__FILE__).'/login.htm'); </span> </li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">html</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">str_replace</font></span><span>('{_ts_}',$ts, $html); </span> </li> <li class="alt"> <span> $</span><span class="attribute"><font color="#ff0000">html</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">str_replace</font></span><span>('{_server_no_}',$server_no, $html); </span> </li> <li class=""><span> return $html; </span></li> <li class="alt"><span> } </span></li> <li class=""><span> </span></li> <li class="alt"><span> function curlFunc($array) </span></li> <li class=""><span> { </span></li> <li class="alt"> <span> $</span><span class="attribute"><font color="#ff0000">ch</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">curl_init</font></span><span>(); </span> </li> <li class=""><span> curl_setopt($ch, CURLOPT_URL, $array['url']); </span></li> <li class="alt"><span> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); </span></li> <li class=""><span> if( isset($array['header']) && $array['header'] ) { </span></li> <li class="alt"><span> curl_setopt($ch, CURLOPT_HEADER, 1); </span></li> <li class=""><span> } </span></li> <li class="alt"><span> if(isset($array['httpheader'])) { </span></li> <li class=""><span> curl_setopt($ch, CURLOPT_HTTPHEADER, $array['httpheader']); </span></li> <li class="alt"><span> } </span></li> <li class=""><span> if(isset($array['referer'])) { </span></li> <li class="alt"><span> curl_setopt($ch, CURLOPT_REFERER, $array['referer']); </span></li> <li class=""><span> } </span></li> <li class="alt"><span> if( isset($array['post']) ) { </span></li> <li class=""><span> curl_setopt($ch, CURLOPT_POST, 1 ); </span></li> <li class="alt"><span> curl_setopt($ch, CURLOPT_POSTFIELDS, $array['post']); </span></li> <li class=""><span> } </span></li> <li class="alt"><span> if( isset($array['cookie']) ){ </span></li> <li class=""><span> curl_setopt($ch, CURLOPT_COOKIE, $array['cookie']); </span></li> <li class="alt"><span> } </span></li> <li class=""><span> $r['erro'] = curl_error($ch); </span></li> <li class="alt"><span> $r['errno'] = curl_errno($ch); </span></li> <li class=""><span> $r['html'] = curl_exec($ch); </span></li> <li class="alt"><span> $r['http_code'] = curl_getinfo($ch, CURLINFO_HTTP_CODE); </span></li> <li class=""><span> curl_close($ch); </span></li> <li class="alt"><span> return $r; </span></li> <li class=""><span> } </span></li> <li class="alt"><span> </span></li> <li class=""><span> /** </span></li> <li class="alt"><span> * 获取验证码图片和cookie </span></li> <li class=""><span> * @param Null </span></li> <li class="alt"><span> * </span></li> <li class=""> <span> * @return array('img'=</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>String, 'cookie'=</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>String) </span> </li> <li class="alt"><span> */ </span></li> <li class=""><span> function getVFCode () </span></li> <li class="alt"><span> { </span></li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">vfcode</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">array</font></span><span>( </span> </li> <li class="alt"> <span> 'header' =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> true, </span> </li> <li class=""> <span> 'cookie' =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> false, </span> </li> <li class="alt"> <span> 'url'=</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>'http://ptlogin2.qq.com/getimage?</span><span class="attribute"><font color="#ff0000">aid</font></span><span>='.$_GET['aid</span><span class="attribute-value"><font color="#0000ff">'].'</font></span><span>&'.@$_GET['t'], </span> </li> <li class=""><span> ); </span></li> <li class="alt"><span> </span></li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">r</font></span><span> = $this-</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>curlFunc($vfcode); </span> </li> <li class="alt"><span> if ($r['http_code'] != 200 ) return false; </span></li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">data</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">split</font></span><span>("n", $r['html']); </span> </li> <li class="alt"> <span> preg_match('/</span><span class="attribute"><font color="#ff0000">verifysession</font></span><span>=([^;]+);/',$data[5], $temp); </span> </li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">cookie</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">trim</font></span><span>($temp[1]); </span> </li> <li class="alt"> <span> $</span><span class="attribute"><font color="#ff0000">img</font></span><span> = $data[9]; </span> </li> <li class=""> <span> return array('img'=</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>$img,'cookie'=</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>$cookie); </span> </li> <li class="alt"><span> } </span></li> <li class=""><span> </span></li> <li class="alt"><span> /** </span></li> <li class=""><span> * 登陆qq邮箱 </span></li> <li class="alt"><span> * </span></li> <li class=""><span> * @param $cookie getvfcode中生成的cookie </span></li> <li class="alt"><span> * </span></li> <li class=""><span> * @return array( </span></li> <li class="alt"> <span> * </span><span class="attribute"><font color="#ff0000">sid</font></span><span>=</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>String , //用户认证的唯一标示 </span> </li> <li class=""> <span> * </span><span class="attribute"><font color="#ff0000">login</font></span><span> =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> Boolean, //true 登陆成功 ,false 登陆失败 </span> </li> <li class="alt"> <span> * </span><span class="attribute"><font color="#ff0000">server_no</font></span><span> =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> String // 服务器编号 </span> </li> <li class=""> <span> * </span><span class="attribute"><font color="#ff0000">active</font></span><span> =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> Boolean //true 已开通 ,false 未开通 邮箱 </span> </li> <li class="alt"> <span> * </span><span class="attribute"><font color="#ff0000">cookie</font></span><span> =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> String // 获取数据cookie </span> </li> <li class=""><span> * </span></li> <li class="alt"><span> * ); </span></li> <li class=""><span> */ </span></li> <li class="alt"><span> function login($cookie) </span></li> <li class=""><span> { </span></li> <li class="alt"><span> /* 生成参数字符串 */ </span></li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">post</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">array</font></span><span>(); </span> </li> <li class="alt"> <span> foreach($_POST as $</span><span class="attribute"><font color="#ff0000">k</font></span><span> =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> $v) { </span> </li> <li class=""><span> $post[] = $k.'='.urlencode($v); </span></li> <li class="alt"><span> } </span></li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">poststr</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">implode</font></span><span>('&',$post); </span> </li> <li class="alt"><span> $r['server_no'] = $_GET['server_no']; </span></li> <li class=""><span> </span></li> <li class="alt"> <span> $</span><span class="attribute"><font color="#ff0000">login</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">array</font></span><span>( </span> </li> <li class=""> <span> 'url'=</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>'http://'.$r['server_no'].'.mail.qq.com/cgi-bin/login?</span><span class="attribute"><font color="#ff0000">sid</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">0</font></span><span>,2,zh_CN', </span> </li> <li class="alt"> <span> 'header' =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> true, </span> </li> <li class=""> <span> 'cookie' =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> '</span><span class="attribute"><font color="#ff0000">verifysession</font></span><span>='.$cookie, </span> </li> <li class="alt"> <span> 'referer' =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> 'http://mail.qq.com/cgi-bin/loginpage', </span> </li> <li class=""> <span> 'httpheader'=</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>array( </span> </li> <li class="alt"><span> "Host: " . $r['server_no'] . '.mail.qq.com', </span></li> <li class=""><span> "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.9) Gecko/2009040821 Firefox/3.0.9 FirePHP/0.2.4", </span></li> <li class="alt"><span> "Content-Type: application/x-www-form-urlencoded", </span></li> <li class=""><span> ), </span></li> <li class="alt"> <span> 'post' =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> $poststr , </span> </li> <li class=""><span> ); </span></li> <li class="alt"> <span> $</span><span class="attribute"><font color="#ff0000">data</font></span><span> = $this-</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>curlFunc($login); </span> </li> <li class=""><span> $data['html'] = iconv("gb2312", "UTF-8", $data['html']); </span></li> <li class="alt"><span> if ($data['http_code'] != 200) { </span></li> <li class=""> <span> $this-</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>error($data); </span> </li> <li class="alt"><span> return false; </span></li> <li class=""><span> } </span></li> <li class="alt"><span> </span></li> <li class=""><span> /* 测试数据 */ </span></li> <li class="alt"><span> //$data['html'] =file_get_contents('./r.txt'); </span></li> <li class=""><span> $r['uin'] = $_POST['uin']; </span></li> <li class="alt"><span> /* 登陆错误的判断 */ </span></li> <li class=""> <span> if (preg_match('|</span><span class="attribute"><font color="#ff0000">errtype</font></span><span>=(d)|', $data['html'], $temp_err)) { </span> </li> <li class="alt"><span> $r['login'] = false; </span></li> <li class=""><span> if ($temp_err[1] == 1) { </span></li> <li class="alt"><span> $r['msg'] = '账号和密码错误'; </span></li> <li class=""><span> } elseif ($temp_err[1] == 2) { </span></li> <li class="alt"><span> $r['msg'] = '验证码错误'; </span></li> <li class=""><span> } </span></li> <li class="alt"><span> return $r; </span></li> <li class=""><span> } </span></li> <li class="alt"><span> /* 登陆成功 */ </span></li> <li class=""> <span> preg_match('|</span><span class="attribute"><font color="#ff0000">urlHead</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">"([^"</font></span><span>]+)"|i',$data['html'],$temp_url); </span> </li> <li class="alt"> <span> $</span><span class="attribute"><font color="#ff0000">urlhead</font></span><span> = $temp_url[1]; </span> </li> <li class=""> <span> if (preg_match('|frame_html?</span><span class="attribute"><font color="#ff0000">sid</font></span><span>=([^"]+)"|i',$data['html'],$temp_sid) ) { </span> </li> <li class="alt"><span> $r['sid'] = $temp_sid[1]; </span></li> <li class=""><span> $r['active'] = true; </span></li> <li class="alt"> <span> } elseif (preg_match('|autoactivation?</span><span class="attribute"><font color="#ff0000">sid</font></span><span>=([^&]+)?&|i',$data['html'],$temp_sid) ) { </span> </li> <li class=""><span> $r['sid'] = $temp_sid[1]; </span></li> <li class="alt"><span> $r['active'] = false; </span></li> <li class=""><span> } </span></li> <li class="alt"><span> /* 登录后cookie的获取 ,在后续操作中用到 */ </span></li> <li class=""><span> if (preg_match_all('|Set-Cookie:([^=]+=[^;]+)|i', $data['html'], $new_cookies) ) { </span></li> <li class="alt"> <span> $</span><span class="attribute"><font color="#ff0000">cookiestr</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">implode</font></span><span>('; ', $new_cookies[1]); </span> </li> <li class=""> <span> $cookiestr </span><span class="attribute"><font color="#ff0000">.</font></span><span>= </span><span class="attribute-value"><font color="#0000ff">'; verifysession='</font></span><span>.$cookie; </span> </li> <li class="alt"><span> } </span></li> <li class=""><span> </span></li> <li class="alt"><span> $r['login'] = true; </span></li> <li class=""><span> $r['cookie'] = $cookiestr; </span></li> <li class="alt"><span> return $r; </span></li> <li class=""><span> } </span></li> <li class="alt"><span> </span></li> <li class=""><span> function openEmail($param) </span></li> <li class="alt"><span> { </span></li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">openEmail</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">array</font></span><span>( </span> </li> <li class="alt"> <span> 'url'=</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>'http://'.$param['server_no'].'.mail.qq.com/cgi-bin/autoactivation?</span><span class="attribute"><font color="#ff0000">actmode</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">6</font></span><span>&</span><span class="attribute"><font color="#ff0000">sid</font></span><span class="attribute-value"><font color="#0000ff">sid</font></span><span>='.$param['sid'], </span> </li> <li class=""> <span> 'header' =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> true, </span> </li> <li class="alt"> <span> 'cookie' =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> $param['cookie'], </span> </li> <li class=""> <span> 'referer' =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> 'http://'.$param['server_no'].'mail.qq.com/cgi-bin/autoactivation?</span><span class="attribute"><font color="#ff0000">sid</font></span><span>='.$param['sid</span><span class="attribute-value"><font color="#0000ff">'].'</font></span><span>&</span><span class="attribute"><font color="#ff0000">action</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">reg_activate</font></span><span>&</span><span class="attribute"><font color="#ff0000">actmode</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">6</font></span><span>', </span> </li> <li class="alt"> <span> 'httpheader'=</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>array( </span> </li> <li class=""><span> "Host: " . $param['server_no'] . '.mail.qq.com', </span></li> <li class="alt"> <span> 'Accept-Charset: gb2312,utf-8;</span><span class="attribute"><font color="#ff0000">q</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">0</font></span><span>.7,*;</span><span class="attribute"><font color="#ff0000">q</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">0</font></span><span>.7', </span> </li> <li class=""><span> "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.9) Gecko/2009040821 Firefox/3.0.9 FirePHP/0.2.4", </span></li> <li class="alt"><span> ), </span></li> <li class=""><span> ); </span></li> <li class="alt"><span> </span></li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">data</font></span><span> = $this-</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>curlFunc($openEmail); </span> </li> <li class="alt"> <span> if (preg_match('|</span><span class="attribute"><font color="#ff0000">Set-Cookie:qqmail_activated</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">0</font></span><span>|i', $data['html'])) { </span> </li> <li class=""><span> $param['active'] = true; </span></li> <li class="alt"> <span> $param['cookie'] = $param['cookie'] .'; </span><span class="attribute"><font color="#ff0000">qqmail_activated</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">0</font></span><span>; </span><span class="attribute"><font color="#ff0000">qqmail_alias</font></span><span>='; </span> </li> <li class=""><span> } </span></li> <li class="alt"><span> return $param; </span></li> <li class=""><span> } </span></li> <li class="alt"><span> </span></li> <li class=""><span> /** </span></li> <li class="alt"><span> * </span></li> <li class=""><span> * 获取friends数据 </span></li> <li class="alt"><span> * </span></li> <li class=""> <span> * @param $</span><span class="attribute"><font color="#ff0000">param</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">array</font></span><span>( </span> </li> <li class="alt"> <span> * </span><span class="attribute"><font color="#ff0000">sid</font></span><span>=</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>String , //用户认证的唯一标示 </span> </li> <li class=""> <span> * </span><span class="attribute"><font color="#ff0000">login</font></span><span> =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> Boolean, //true 登陆成功 ,false 登陆失败 </span> </li> <li class="alt"> <span> * </span><span class="attribute"><font color="#ff0000">server_no</font></span><span> =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> String // 服务器编号 </span> </li> <li class=""> <span> * </span><span class="attribute"><font color="#ff0000">active</font></span><span> =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> Boolean //true 已开通 ,false 未开通 邮箱 </span> </li> <li class="alt"> <span> * </span><span class="attribute"><font color="#ff0000">cookie</font></span><span> =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> String // 获取数据cookie </span> </li> <li class=""><span> * </span></li> <li class="alt"><span> * ); </span></li> <li class=""><span> * @return Array( </span></li> <li class="alt"> <span> * </span><span class="attribute"><font color="#ff0000">key</font></span><span>=</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>value, // key:qq号,value: nickname </span> </li> <li class=""><span> * ); </span></li> <li class="alt"><span> */ </span></li> <li class=""><span> function getFriends($param) </span></li> <li class="alt"><span> { </span></li> <li class=""><span> </span></li> <li class="alt"> <span> $</span><span class="attribute"><font color="#ff0000">friend</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">array</font></span><span>( </span> </li> <li class=""> <span> 'url'=</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>'http://'.$param['server_no'].'.mail.qq.com/cgi-bin/addr_listall?</span><span class="attribute"><font color="#ff0000">type</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">user</font></span><span>&&</span><span class="attribute"><font color="#ff0000">category</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">all</font></span><span>&</span><span class="attribute"><font color="#ff0000">sid</font></span><span class="attribute-value"><font color="#0000ff">sid</font></span><span>='.$param['sid'], </span> </li> <li class="alt"> <span> 'header' =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> true, </span> </li> <li class=""> <span> 'cookie' =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> $param['cookie'], </span> </li> <li class="alt"> <span> 'referer' =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> 'http://m151.mail.qq.com/cgi-bin/addr_listall?</span><span class="attribute"><font color="#ff0000">sid</font></span><span>='.$param['sid</span><span class="attribute-value"><font color="#0000ff">'].'</font></span><span>&</span><span class="attribute"><font color="#ff0000">sorttype</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">null</font></span><span>&</span><span class="attribute"><font color="#ff0000">category</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">common</font></span><span>', </span> </li> <li class=""> <span> 'httpheader'=</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>array( </span> </li> <li class="alt"><span> "Host: " . $param['server_no'] . '.mail.qq.com', </span></li> <li class=""> <span> 'Accept-Charset:utf-8;</span><span class="attribute"><font color="#ff0000">q</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">0</font></span><span>.7,*;</span><span class="attribute"><font color="#ff0000">q</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">0</font></span><span>.7', </span> </li> <li class="alt"><span> "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.9) Gecko/2009040821 Firefox/3.0.9 FirePHP/0.2.4", </span></li> <li class=""><span> ), </span></li> <li class="alt"><span> ); </span></li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">r</font></span><span> = $this-</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>curlFunc($friend); </span> </li> <li class="alt"><span> if ($r['http_code'] != 200) { </span></li> <li class=""> <span> $this-</span><span class="tag"><strong><font color="#006699">></font></strong></span><span>error($r); </span> </li> <li class="alt"><span> return false; </span></li> <li class=""><span> } </span></li> <li class="alt"> <span> $</span><span class="attribute"><font color="#ff0000">data</font></span><span> = $r['html']; </span> </li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">preg</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">preg_match_all</font></span><span>('|</span><strong><font color="#006699"><span class="tag"><</SPAN><SPAN class=tag-name>p</SPAN></FONT></STRONG><SPAN> </SPAN><SPAN class=attribute><FONT color=#ff0000>class</FONT></SPAN><SPAN>=</SPAN><SPAN class=attribute-value><FONT color=#0000ff>"L_n"</FONT></SPAN><STRONG><FONT color=#006699><SPAN class=tag>></span><span class="tag"><</SPAN><SPAN class=tag-name>span</SPAN><SPAN class=tag>></span><span class="tag"><</SPAN><SPAN class=tag-name>img</SPAN></FONT></STRONG><SPAN> </SPAN><SPAN class=attribute><FONT color=#ff0000>class</FONT></SPAN><SPAN>=</SPAN><SPAN class=attribute-value><FONT color=#0000ff>"L_q"</FONT></SPAN><SPAN> </SPAN><SPAN class=attribute><FONT color=#ff0000>name</FONT></SPAN><SPAN>=</SPAN><SPAN class=attribute-value><FONT color=#0000ff>qqplusimg</FONT></SPAN><SPAN> </SPAN><SPAN class=attribute><FONT color=#ff0000>key</FONT></SPAN><SPAN>=</SPAN><SPAN class=attribute-value><FONT color=#0000ff>"(d+)"</FONT></SPAN><SPAN>[^</SPAN><SPAN class=tag><STRONG><FONT color=#006699>></span></font></strong><span>]+</span><span class="tag"><strong><font color="#006699">/></font></strong></span><span> ([^</span><span class="tag"><strong><font color="#006699"><</FONT></STRONG></SPAN><SPAN>]+)</SPAN><STRONG><FONT color=#006699><SPAN class=tag></</SPAN><SPAN class=tag-name>span</SPAN><SPAN class=tag>></font></strong></span><span class="tag"></</SPAN><SPAN class=tag-name>p</SPAN><SPAN class=tag>></span><span>|i', $data, $temp_list); </span> </li> <li class="alt"> <span> if ($</span><span class="attribute"><font color="#ff0000">preg</font></span><span> == 0) return array(); </span> </li> <li class=""> <span> $</span><span class="attribute"><font color="#ff0000">list</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">array_combine</font></span><span>($temp_list[1],$temp_list[2]); </span> </li> <li class="alt"><span> return $list; </span></li> <li class=""><span> } </span></li> <li class="alt"><span> </span></li> <li class=""><span> /** </span></li> <li class="alt"><span> * 错误显示 </span></li> <li class=""><span> * </span></li> <li class="alt"><span> * @param $str array </span></li> <li class=""><span> * </span></li> <li class="alt"><span> * @return </span></li> <li class=""><span> */ </span></li> <li class="alt"><span> function error($str) { </span></li> <li class=""><span> $str['html'] = str_replace('script','', $str['html']); </span></li> <li class="alt"><span> var_dump($str); </span></li> <li class=""><span> exit; </span></li> <li class="alt"><span> } </span></li> <li class=""><span>} </span></li> <li class="alt"><span> </span></li> <li class=""> <span></span><span class="tag"><strong><font color="#006699">?></font></strong></span><span> </span> </li> </ol>
, through the above introduction to the code for PHP to get QQ mailbox friends , have you fully mastered it?