This article introduces you to using Asp to implement QQ online query function. The knowledge points involved include XMLHttp to read the corresponding html code of Tencent website to obtain the QQ avatar. Friends who are interested in QQ online query can refer to this article
The QQ online query function code shared with you in this article is very simple, the specific content is as follows:
The method of this program is to use XMLHTTP to read the corresponding HTML code of Tencent website to obtain the QQ avatar. According to this idea, we can also crawl a lot of information from other websites, such as weather forecasts, news, etc.
- <scriptlanguage=JavaScript>
- <!--
- functiongetFaceImg (QQcode)
- {
- varRe=newRegExp(^[1-9]{1}/d+$,g);
- if (!QQcode !Re.test (QQcode)) return;
- varURL=http://search.tencent.com/cgi-bin/friend/oicq_find?oicq_no=+QQcode;
- varhttp=newActiveXObject(Microsoft.XMLHTTP);
- http.open(GET,URL,false,,);
- http.setRequestHeader(CONTENT-TYPE,text/html;Charset=gb2312);
- http.send();
- if (http.status!=200) return;
- varwebStr=http.responseText;
- Re=newRegExp((http://img.tencent.com/face/[^]+),ig);
- if(Re.test(webStr))
- return<ahref=http://search.tencent.com/cgi-bin/friend/user_show_info?ln=+QQcode+target=_blanktitle=QQ:+QQcode+><imgsrc=+RegExp.$1+width=16height=16border= 0></a>;
- http=null;
- }
- document.write (my QQ status: +getFaceImg (44723461));
- //-->
- </script>
The above is all about this article, I hope you like it.