 




<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The VBScript Network and Systems Administrator&#039;s Cafe &#187; HTML</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator</link>
	<description></description>
	<lastBuildDate>Tue, 11 Oct 2011 18:36:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>How to retrieve HTML web pages with VBScript via the Microsoft.XmlHttp object</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/how-to-retrieve-html-web-pages-with-vbscript-via-the-microsoftxmlhttp-object/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/how-to-retrieve-html-web-pages-with-vbscript-via-the-microsoftxmlhttp-object/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 15:00:05 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[Microsoft.XmlHttp]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[VBScript Objects]]></category>
		<category><![CDATA[Web Pages]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/how-to-retrieve-html-web-pages-with-vbscript-via-the-microsoftxmlhttp-object/</guid>
		<description><![CDATA[Recently, I had a situation where I had to pull down a HTML page to compare it to a known copy of the page. Certainly, IE or FireFox&#8211; or Google&#8217;s Chrome would have done the trick and I could have viewed the source. But that would require me to do work every time we needed to [...]]]></description>
				<content:encoded><![CDATA[<p><font color="#0000ff"><font color="#000000">Recently, I had a situation where I had to pull down a HTML page to compare it to a known copy of the page. Certainly, IE or FireFox&#8211; or Google&#8217;s Chrome would have done the trick and I could have viewed the source. But that would require me to do work every time we needed to check the page against the known good source.</font></font></p>
<p><font color="#0000ff"><font color="#000000"> Instead I wrote a script to pull the HTML source and echo the response to the console (or a messag box if you are not using cscript to execute the script). While not a full blown HTTP QA script it does do the job of getting the HTTP responses from the server and is certainly a core part of any QA script anyone would write.</font></font></p>
<p>Basically the script uses the Microsoft.XMLHTTP object to preform all the HTTP calls and retrieve the HTML page. It sounds scary, but if you look at the script below I think you&#8217;ll find that it really is quite easy to accomplish<font color="#0000ff"><font color="#000000">.  So, here is the script&#8217;s code:</font></font></p>
<p><font color="#0000ff">URL=&#8221;</font><a href="http://www.gamersigs.net/"><font color="#0000ff">http://www.gamersigs.net/</font></a><font color="#0000ff">&#8220;<br />
</font><font color="#0000ff">Set WshShell = WScript.CreateObject(&#8220;WScript.Shell&#8221;)<br />
</font><font color="#0000ff">Set http = CreateObject(&#8220;Microsoft.XmlHttp&#8221;)</font></p>
<p><font color="#0000ff">On Error Resume Next<br />
http.open &#8220;GET&#8221;, URL, False<br />
http.send &#8220;&#8221;<br />
if err.Number = 0 Then<br />
     WScript.Echo http.responseText<br />
Else<br />
     Wscript.Echo &#8220;error &#8221; &amp; Err.Number &amp; &#8220;: &#8221; &amp; Err.Description<br />
End If<br />
set WshShell = Nothing<br />
Set http = Nothing<br />
</font></p>
<p><font color="#0000ff"><font color="#000000">Enjoy!</font></font></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/how-to-retrieve-html-web-pages-with-vbscript-via-the-microsoftxmlhttp-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
