Description

Socket function used to retrieve the contents of a webpage.

Syntax

retval = GetWebPage(url)

Parameters

Parameter
url

The web address of the webpage to retrieve.

Returns

A the HTML and response data.

Example

Declare Function GetWebPage
 
url = "http://www.google.com"
retval =  getwebpage( url )
Swap Char(13) : char(10) With @fm In retval
Swap char(10) With @fm In retval
Swap @fm With char(13) : char(10) In retval
OSWrite retval To "C:\url.txt"
 
* This will return the following
 
HTTP/1.0 200 OK
Date: Wed, 31 Mar 2010 19:23:44 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie: PREF=ID=34b925c566dc62b0:TM=1270063424:LM=1270063424:S=7pP44X2pnsBmsBpe; expires=Fri, 30-Mar-2012 19:23:44 GMT; path=/; domain=.google.com
Set-Cookie: NID=33=fP8eYZi6QSBXcLxqraz38TKBLGevc31zSKTNM3RQPKjNClRCb-SK6t2fHFizLnaHxhKny_A-DoswzNZodkR1zqIbOssrN04CRMzRPK1c6Tm4CXoLcPbK270FK-uAiLiJ; expires=Thu, 30-Sep-2010 19:23:44 GMT; path=/; domain=.google.com; HttpOnly
Server: gws
X-XSS-Protection: 0
<!doctype html><html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Google</title><script>window.google={kEI:"QKGzS-OhD4eSeIXt7NgO",kEXPI:"23199,24063,24117,24222,24245,24253,24291",kCSI:{e:"23199,24063,24117,24222,24245,24253,24291",ei:"QKGzS-OhD4eSeIXt7NgO",expi:"23199,24063,24117,24222,24245,24253,24291"},ml:function(){},kHL:"en",time:function(){return(new Date).getTime()},log:function(b,d,c){var a=new Image,e=google,g=e.lc,f=e.li;a.onerror=(a.onload=(a.onabort=function(){delete g[f]}));g[f]=a;c=c||"/gen_204?atyp=i&ct="+b+"&cad="+d+"&zx="+google.time();a.src=c;e.li=f+1},lc:[],li:0,Toolbelt:{}};
window.google.sn="webhp";window.google.timers={load:{t:{start:(new Date).getTime()}}};try{}catch(u){}window.google.jsrt_kill=1;
var _gjwl=location;function _gjuc(){var e=_gjwl.href.indexOf("#");if(e>=0){var a=_gjwl.href.substring(e);if(a.indexOf("&q=")>0||a.indexOf("#q=")>=0){a=a.substring(1);if(a.indexOf("#")==-1){for(var c=0;c<a.length;){var d=c;if(a.charAt(d)=="&")++d;var b=a.indexOf("&",d);if(b==-1)b=a.length;var f=a.substring(d,b);if(f.indexOf("fp=")==0){a=a.substring(0,c)+a.substring(b,a.length);b=c}else if(f=="cad=h")return 0;c=b}_gjwl.href="/search?"+a+"&cad=h";return 1}}}return 0}function _gjp(){!(window._gjwl.hash&&
window._gjuc())&&setTimeout(_gjp,500)};
window._gjp && _gjp()</script><style>td{line-height:.8em;}.gac_m td{line-height:17px;}form{margin-bottom:20px;}body,td,a,p,.h{font-family:arial,sans-serif}.h{color:#36c;font-size:20px}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}em{font-weight:bold;font-style:normal}.lst{font:17px arial,sans-serif;margin-bottom:.2em;vertical-align:bottom;}input{font-family:inherit}.lsb,.gac_sb{font-size:15px;height:1.85em!important;margin:.2em;}#gbar,#guser{font-size:13px;padding-top:1px !important}#gbar{float:left;height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}#gbs,.gbm{background:#fff;left:0;position:absolute;text-align:left;visibility:hidden;z-index:1000}.gbm{border:1px solid;border-color:#c9d7f1 #36c #36c #a2bae7;z-index:1001}.gb1{margin-right:.5em}.gb1,.gb3{zoom:1}.gb2{display:block;padding:.2em .5em;}.gb2,.gb3{text-decoration:none;border-bottom:none}a.gb1,a.gb2,a.gb3,a.gb4{color:#00c !important}a.gb2:hover{background:#36c;color:#fff !important}</style><script>google.y={};google.x=function(e,g){google.y[e.id]=[e,g];return false};window.gbar={qs:function(){},tg:function(e){var o={id:'gbar'};for(i in e)o[i]=e[i];google.x(o,function(){gbar.tg(o)})}};</script></head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="document.f.q.focus();if(document.images)new Image().src='/images/nav_logo8.png'" topmargin=3 marginheight=3><textarea id=csi style=display:none></textarea><iframe name=wgjf style=display:none></iframe><div id=ghead><div id=gbar><nobr><b class="gb1">Web</b> <a href="http://images.google.com/imghp?hl=en&tab=wi" onclick=gbar.qs(this) class="gb1">Images</a> <a href="http://video.google.com/?hl=en&tab=wv" onclick=gbar.qs(this) class="gb1">Videos</a> <a href="http://maps.google.com/maps?hl=en&tab=wl" onclick=gbar.qs(this) class="gb1">Maps</a> <a href="http://news.google.com/nwshp?hl=en&tab=wn" onclick=gbar.qs(this) class="gb1">News</a> <a href="http://www.google.com/prdhp?hl=en&tab=wf" onclick=gbar.qs(this) class="gb1">Shopping</a> <a href="http://mail.google.com/mail/?hl=en&tab=wm" class="gb1">Gmail</a> <a href="http://www.google.com/intl/en/options/" onclick="this.blur();gbar.tg(event);return !1" aria-haspopup=true class="gb3"><u>more</u> <small>▼</small></a><div class="gbm" id=gbi><a href="http://books.google.com/bkshp?hl=en&tab=wp" onclick=gbar.qs(this) class="gb2">Books</a> <a href="http://www.google.com/finance?hl=en&tab=we" onclick=gbar.qs(this) class="gb2">Finance</a> <a href="http://translate.google.com/?hl=en&tab=wT" onclick=gbar.qs(this) class="gb2">Translate</a> <a href="http://scholar.google.com/schhp?hl=en&tab=ws" onclick=gbar.qs(this) class="gb2">Scholar</a> <a href="http://blogsearch.google.com/?hl=en&tab=wb" onclick=gbar.qs(this) class="gb2">Blogs</a> <div class="gb2"><div class="gbd"></div></div><a href="http://www.youtube.com/?hl=en&tab=w1" onclick=gbar.qs(this) class="gb2">YouTube</a> <a href="http://www.google.com/calendar/render?hl=en&tab=wc" class="gb2">Calendar</a> <a href="http://picasaweb.google.com/home?hl=en&tab=wq" onclick=gbar.qs(this) class="gb2">Photos</a> <a href="http://docs.google.com/?hl=en&tab=wo" class="gb2">Documents</a> <a href="http://www.google.com/reader/view/?hl=en&tab=wy" class="gb2">Reader</a> <a href="http://sites.google.com/?hl=en&tab=w3" class="gb2">Sites</a> <a href="http://groups.google.com/grphp?hl=en&tab=wg" onclick=gbar.qs(this) class="gb2">Groups</a> <div class="gb2"><div class="gbd"></div></div><a href="http://www.google.com/intl/en/options/" class="gb2">even more »</a> </div></nobr></div><div id=guser width=100%><nobr><span id=gbn class="gbi"></span><span id=gbf class="gbf"></span><span id=gbe><a href="/url?sa=p&pref=ig&pval=3&q=http://www.google.com/ig%3Fhl%3Den%26source%3Diglk&usg=AFQjCNFA18XPfgb7dKnXfKz7x7g1GDH1tg" class="gb4">iGoogle</a> | </span><a href="/preferences?hl=en" class="gb4">Search settings</a> | <a href="https://www.google.com/accounts/Login?hl=en&continue=http://www.google.com/" class="gb4">Sign in</a></nobr></div><div class="gbh" style=left:0></div><div class="gbh" style=right:0></div></div> <center><br clear=all id=lgpd><img alt="Google" height=110 src="/intl/en_ALL/images/logo.gif" width=276 id=logo onload="window.lol&&lol()"><br><br><form action="/search" name=f><table cellpadding=0 cellspacing=0><tr valign=top><td width=25%> </td><td align=center nowrap><input name=hl type=hidden value=en><input name=source type=hidden value=hp><input type=hidden name=ie value="ISO-8859-1"><input autocomplete="off" maxlength=2048 name=q size=55 class="lst" title="Google Search" value=""><br><input name=btnG type=submit value="Google Search" class="lsb"><input name=btnI type=submit value="I'm Feeling Lucky" class="lsb"></td><td nowrap width=25% align=left><font size=-2>  <a href="/advanced_search?hl=en">Advanced Search</a><br>  <a href="/language_tools?hl=en">Language Tools</a></font></td></tr></table></form><br><font size=-1><font color=red>New!</font> <a href="/aclk?sa=L&ai=CXZG2OqGzS7wgzYq2B9bWwNcLs_2WoQGJp86fEMHZnNkTEAEgwVRQ_evAn_z_____AWB9qgSGAU_QjRFwYJmCMELkXY89bB9ee413aEv71iyHLJeVfxWFcMpSrbHGFuPPQaGXkep8Y4gDLwUPP4GfundX8k6ApK9ssSq7XeNLrauMJg9ldNP_B_BPJHdo-AeiUstyrBEZlrzHvZPNHaV1YF029hWHzbELAM_gWqYaA5pe6r1xERKOY0pbT7Zj&num=1&sig=AGiWqtyzip0s9mYEWPfEGxAR8AcsYOSP2w&q=http://www.google.com/help/ig/travel/">Travel the world</a> from your Google homepage</font><br><br><span id=footer><center id=fctr><br><font size=-1><a href="/intl/en/ads/">Advertising Programs</a> - <a href="/services/">Business Solutions</a> - <a href="/intl/en/about.html">About Google</a></font><p><font size=-2>©2010 - <a href="/intl/en/privacy.html">Privacy</a></font></p></center></span> <div id=xjsd></div><div id=xjsi><script>if(google.y)google.y.first=[];if(google.y)google.y.first=[];google.dstr=[];google.rein=[];window.setTimeout(function(){var a=document.createElement("script");a.src="/extern_js/f/CgJlbhICdXMgACswCjheQAgsKzAOOAwsKzAWOBcsKzAXOAYsKzAYOAUsKzAZOBksKzAlOMqIASwrMCY4CSwrMCc4BCwrMDw4AiwrMEA4DiwrMEQ4AiwrMEU4ASwrME44Aiw/cx_YvgiOYyc.js";(document.getElementById("xjsd")||document.body).appendChild(a);if(google.timers&&google.timers.load.t)google.timers.load.t.xjsls=(new Date).getTime();},0);
;google.neegg=1;google.y.first.push(function(){google.ac.m=1;google.ac.b=true;google.ac.i(document.f,document.f.q,'','','',{a:1,o:1});google.History&&google.History.initialize('/')});if(google.j&&google.j.en&&google.j.xi){window.setTimeout(google.j.xi,0);google.fade=null;}</script></div><script>(function(){
var b,d,e,f;function g(a,c){if(a.removeEventListener){a.removeEventListener("load",c,false);a.removeEventListener("error",c,false)}else{a.detachEvent("onload",c);a.detachEvent("onerror",c)}}function h(a){f=(new Date).getTime();++d;a=a||window.event;var c=a.target||a.srcElement;g(c,h)}var i=document.getElementsByTagName("img");b=i.length;d=0;for(var j=0,k;j<b;++j){k=i[j];g(k,h);if(k.complete||typeof k.src!="string"||!k.src)++d;else if(k.addEventListener){k.addEventListener("load",h,false);k.addEventListener("error",
h,false)}else{k.attachEvent("onload",h);k.attachEvent("onerror",h)}}e=b-d;function l(){google.timers.load.t.ol=(new Date).getTime();google.timers.load.t.iml=f;google.kCSI.imc=d;google.kCSI.imn=b;google.kCSI.imp=e;google.report&&google.report(google.timers.load,google.kCSI)}if(window.addEventListener)window.addEventListener("load",l,false);else if(window.attachEvent)window.attachEvent("onload",l);google.timers.load.t.prt=(f=(new Date).getTime());
})();
</script>
*
  • No labels