web tools rank checker

domain .cn
.net .cn .com.cn
你正在阅览 :: 简体中文:: 学习 ASP SQL VB HTML code

学习 .ASP SQL HTML XML CSS JAVA Perl code study
English Chinese_Traditional Chinese_Simplified

你正在阅览 :: 简体中文 Chinese_Simplified

学习.主题:
首页
ASP
. Active-Server-Flash
. Array
. Connection
. Count
. Counter
. Distinct
. Email
. File
. Folder
. Function
. GetSQLserver
. Header
. mySQL
. Record
. Recordset
. Request
. Response
. Server
. Server-CreateObject
»AspHTTP-Conn
»Microsoft-XMLDOM
»Microsoft-XMLHTTP
»Microsoft-XMLHTTP-header
»MSXML2-ServerXMLHTTP
. ServerVariables
. Session
. Special-Symbols
. String
. Sub
. Time
CSS
Ecommerce
HTML
InternetProtocol
JAVA
Microsoft
Robots
SearchEngine
SQL
SQLserver
VBscript
XML

SiteMap

3w....学习.教学 > ASP > server-createobject » asphttp-conn

3w learning

server-createobject >
asphttp-conn

Title:

Set HttpObj = Server.CreateObject("AspHTTP.Conn")


获取网页资料
Description:

AspHTTP.Conn can read websites data ----------- note --------- AspHTTP.com may not read https://


获取某网页(自己或他人的网页)资料

Custom Content-Type headers for POST
自动转向
支持多种登陆环境
将远程文件转换成二进制流文件
允许客户端HTTP请求。
Example Code:

Example 1 :: to run a site HTTP <% Set HttpObj = Server.CreateObject("AspHTTP.Conn") HTTPObj.Url = "http://www.-----.com" HTTPObj.TimeOut = 5 'set the timeout strResult = HTTPObj.GetURL SET HTTPobj = nothing response.write strResult %> Example 2 :: to get the HTML code show <% Set HttpObj = Server.CreateObject("AspHTTP.Conn") HTTPObj.Url = "http://www.-----.net" HTTPObj.TimeOut = 5 'set the timeout strResult = HTTPObj.GetURL SET HTTPobj = nothing HTMLstrResult=Server.htmlEncode(strResult) response.write HTMLstrResult %> Example3 and Example4 ------ off html code ---- <% Set HttpObj = Server.CreateObject("AspHTTP.Conn") HTTPObj.Url = "http://www.-----.net" HTTPObj.TimeOut = 5 'set the timeout strResult = HTTPObj.GetURL SET HTTPobj = nothing HTMLstrResult=Server.htmlEncode(strResult) 'response.write HTMLstrResult '-----function clearHTMLCode(originCode)---- function clearHTMLCode(originCode) dim reg set reg = new RegExp reg.Pattern = "<[^>]*>" reg.Global = true clearHTMLCode = reg.Replace(originCode, "") end function '-----function Checkin(s)---------- function Checkin(s) s=trim(s) s=replace(s,vbCrlf,"") s=replace(s,chr(9),"") s=replace(s," ","") s=replace(s,"&nbsp;","") Checkin=s end function ' chr(10) may change some code '----Example 3------ response.write clearHTMLCode(strResult)&"<hr>" '----Example 4------ response.write Checkin(clearHTMLCode(strResult)) %> ------ Example 5 list all hrefs: HttpObj.GetHREFs----- <html> <body> <% '---------------HttpObj.GetHREFs-------- Server.ScriptTimeout = 5 Set HttpObj = Server.CreateObject("AspHTTP.Conn") HttpObj.Url = "http://----.com/" HttpObj.RequestMethod = "GET" HttpObj.UserAgent = "Mozilla/2.0 (compatible; MSIE 6.0B; Windows NT)" strResult = HttpObj.GetURL Response.Write "<h2>A HREF List</h2>" varHREFArray = HttpObj.GetHREFs intHREFArrayLimit = UBound(varHREFArray) -1 For I = 0 to intHREFArrayLimit Response.Write I+1&" : "&varHREFArray(I) & "<br>" & VBCrLF Next %> </body> </html> -----Example 6 ::------------ <% ' get image/gif Response.ContentType = "image/gif" Set HTTPObj = Server.CreateObject("AspHTTP.Conn") HTTPObj.Url = "http://----.com/---.gif" HTTPObj.GetURL Response.BinaryWrite HTTPObj.BinaryData %> ------- Example 7 get and save image file <% Server.ScriptTimeout = 240 Set HttpObj = Server.CreateObject("AspHTTP.Conn") HttpObj.Url = "http://www.----.com/---.gif" HttpObj.FollowRedirects = false HttpObj.RequestMethod = "GET" HttpObj.UserAgent = "Mozilla/2.0 (compatible; MSIE 6.01; Windows NT)" HttpObj.SaveFileTo = "D:/myPath/log.gif" HttpObj.GetURL Response.Write "image saved" %> <% ' ---- Example 8 ----get file and save Set HttpObj = Server.CreateObject("AspHTTP.Conn") HTTPObj.Url = "http://www.----.com/" 'HTTPObj.PostData = "suid=jimb&pwd=macabre&id=32&val=1.5" HTTPObj.TimeOut = 1800 HTTPObj.Accept = "*/*" HTTPObj.FollowRedirects = true HTTPObj.Port = 80 'HTTPObj.Proxy = "---.net:8080" 'HTTPObj.ProxyPassword = "proxyusername:proxypassword" HttpObj.SaveFileTo = "D:/myPath/newfilename.html" HTTPObj.UserAgent = "Mozilla Compatible (MS IE 3.01 WinNT)" HTTPObj.Protocol = "HTTP/1.1" HTTPObj.Authorization = "USER:pass" HTTPObj.ContentType = "application/x-www-form-urlencoded" HTTPObj.RequestMethod = "POST" 'HTTPObj.GetHREFs 'HTTPObj.RequestMethod = "HEAD" strResult = HTTPObj.GetURL response.write strResult %>


---------- Ezer Tips ----------

反制他人不经浏览器或经快快捷方式工具列
来获取网页资料……
SEs 也已经在2006渐渐开始注意到
并发展….. 反制功能
其实获取网页数据就好比网界文机器人
获取网页资料…
Ezer Tips:反制功能主要是能分辨这些使用者
小心使用JAVA可能会影响HttpObj.GetHREFs
的计算结果
-------------
Example Result:

Example website usage: http://link.ezer.com/tools/backlink_checker.asp


Example 1 :: will see a site image of www.----.com Example 2 :: will print the HTML code of www.----.net Example 3 :: will not list any html code of www.----.net Example 4 :: will not list any html code of www.----.net and do not list replaced item Example 5 :: list all href from HttpObj.Url href includes email and file which form as: <a href="____"> URL </a> Attention:: Java ex: onLoad="scrollIn()" at body tag may affect the href counting result.... Example 6 :: get image/gif Example 7 :: get and save image file Example 8 :: get file and save


GET, HEAD and POST 的方法请求
返回HTTP协定头
接受被修改过的HTTP头, 
若无法通过headers status则会产生error
支持代理设置
客户端环境判断
..
...
...

[ 7/27/2008 ]

www learning school add more scripts and tips memo
You are at >>3WS.EZER.COM >> 3WS.EZER.COM/ASP/SERVER-CREATEOBJECT/ASPHTTP-CONN.ASP>>ASP
Helpful link:: SEO web tools :: Live PR | SERP checker
back to top Ezer code adding :: Questions ;email