Andreik Posted May 29, 2008 Posted May 29, 2008 (edited) Hi all, This is my TCP client: expandcollapse popup#include <GUIConstants.au3> #Include <GuiEdit.au3> Global $SOCKET #Region ### START Koda GUI section ### Form= $GUI = GUICreate("NetCom", 286, 296, 201, 124) $Group1 = GUICtrlCreateGroup(" Server Info ", 6, 8, 271, 73) $IP = GUICtrlCreateInput(@IPAddress1, 14, 24, 129, 21) $PORT = GUICtrlCreateInput("80", 14, 48, 129, 21) $CON = GUICtrlCreateButton("CONNECT", 149, 21, 121, 25, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) $DIS = GUICtrlCreateButton("DISCONNECT", 150, 48, 121, 25, 0) $Group2 = GUICtrlCreateGroup(" Connection Info ", 6, 88, 271, 199) $SYSMSG = GUICtrlCreateEdit(">Welcome to NetCom", 12, 104, 257, 109) $SEND_DATA = GUICtrlCreateEdit("", 12, 220, 193, 61) $SEND = GUICtrlCreateButton("SEND", 212, 218, 57, 63, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW,$GUI) #EndRegion ### END Koda GUI section ### While 1 $RECV = TCPRecv($SOCKET,256) If $RECV <> "" Then $TEMP_DATA = GUICtrlRead($SYSMSG) GUICtrlSetData($SYSMSG,$TEMP_DATA & @CRLF & "<<" & $RECV) _GUICtrlEdit_Scroll($SYSMSG,$SB_SCROLLCARET) EndIf $MSG = GUIGetMsg() Switch $MSG Case $GUI_EVENT_CLOSE Exit Case $CON TCPStartup() $SOCKET = TCPConnect(TCPNameToIP(GUICtrlRead($IP)),GUICtrlRead($PORT)) If $SOCKET <> -1 Then $TEMP_DATA = GUICtrlRead($SYSMSG) GUICtrlSetData($SYSMSG,$TEMP_DATA & @CRLF & ">>Connecting to " & GUICtrlRead($IP) & " on port " & GUICtrlRead($PORT)) $TEMP_DATA = GUICtrlRead($SYSMSG) GUICtrlSetData($SYSMSG,$TEMP_DATA & @CRLF & ">>Connection...OK") _GUICtrlEdit_Scroll($SYSMSG,$SB_SCROLLCARET) Else $TEMP_DATA = GUICtrlRead($SYSMSG) GUICtrlSetData($SYSMSG,$TEMP_DATA & @CRLF & ">>Unable to connect to " & GUICtrlRead($IP) & " on port " & GUICtrlRead($PORT)) _GUICtrlEdit_Scroll($SYSMSG,$SB_SCROLLCARET) EndIf Case $DIS $RES = TCPCloseSocket($SOCKET) If $RES = 1 Then $TEMP_DATA = GUICtrlRead($SYSMSG) GUICtrlSetData($SYSMSG,$TEMP_DATA & @CRLF & ">>Disconnecting from " & GUICtrlRead($IP)) $TEMP_DATA = GUICtrlRead($SYSMSG) GUICtrlSetData($SYSMSG,$TEMP_DATA & @CRLF & ">>Disconnect...OK") _GUICtrlEdit_Scroll($SYSMSG,$SB_SCROLLCARET) EndIf Case $SEND TCPSend($SOCKET,GUICtrlRead($SEND_DATA)) $TEMP_DATA = GUICtrlRead($SYSMSG) GUICtrlSetData($SYSMSG,$TEMP_DATA & @CRLF & ">>" & GUICtrlRead($SEND_DATA)) _GUICtrlEdit_Scroll($SYSMSG,$SB_SCROLLCARET) GUICtrlSetData($SEND_DATA,"") Case -3 Exit 0 EndSwitch WEnd I want to get a web page content using this command but not work. What should I do? GET / HTTP/1.1 Edited June 1, 2008 by Andreik
MrCreatoR Posted June 1, 2008 Posted June 1, 2008 To get a source of a web-page via TCP you need to send a GET request, like this: expandcollapse popup$hGUI = GUICreate("GET source via TCP", 400, 300) GUICtrlCreateLabel("Please wait...", 20, 5, 360, 20) GUICtrlSetFont(-1, 10, 800) $Edit = GUICtrlCreateEdit("", 20, 30, 360, 250) GUISetState() $sResponse = _HTTPGet("www.google.com", "/") GUICtrlSetData($Edit, $sResponse) While 1 Switch GUIGetMsg() Case -3 Exit EndSwitch WEnd Func _HTTPGet($sHost, $sPage) Local $iSocket = _HTTPConnect($sHost) If @error Then Return SetError(1, 0, "") Local $sCommand = "GET " & $sPage & " HTTP/1.1" & @CRLF $sCommand &= "Host: " & $sHost & @CRLF $sCommand &= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0" & @CRLF $sCommand &= "Referer: " & $sHost & @CRLF $sCommand &= "Connection: close" & @CRLF & @CRLF Local $BytesSent = TCPSend($iSocket, $sCommand) If $BytesSent = 0 Then Return SetError(2, @error, 0) Local $sRecv = "", $sCurrentRecv While 1 $sCurrentRecv = TCPRecv($iSocket, 16) If @error <> 0 Then ExitLoop If $sCurrentRecv <> "" Then $sRecv &= $sCurrentRecv WEnd _HTTPShutdown($iSocket) Return $sRecv EndFunc Func _HTTPConnect($sHost, $iPort=80) TCPStartup() Local $sName_To_IP = TCPNameToIP($sHost) Local $iSocket = TCPConnect($sName_To_IP, $iPort) If $iSocket = -1 Then TCPCloseSocket($iSocket) Return SetError(1, 0, "") EndIf Return $iSocket EndFunc Func _HTTPShutdown($iSocket) TCPCloseSocket($iSocket) TCPShutdown() EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
Andreik Posted June 2, 2008 Author Posted June 2, 2008 To get a source of a web-page via TCP you need to send a GET request, like this: expandcollapse popup$hGUI = GUICreate("GET source via TCP", 400, 300) GUICtrlCreateLabel("Please wait...", 20, 5, 360, 20) GUICtrlSetFont(-1, 10, 800) $Edit = GUICtrlCreateEdit("", 20, 30, 360, 250) GUISetState() $sResponse = _HTTPGet("www.google.com", "/") GUICtrlSetData($Edit, $sResponse) While 1 Switch GUIGetMsg() Case -3 Exit EndSwitch WEnd Func _HTTPGet($sHost, $sPage) Local $iSocket = _HTTPConnect($sHost) If @error Then Return SetError(1, 0, "") Local $sCommand = "GET " & $sPage & " HTTP/1.1" & @CRLF $sCommand &= "Host: " & $sHost & @CRLF $sCommand &= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0" & @CRLF $sCommand &= "Referer: " & $sHost & @CRLF $sCommand &= "Connection: close" & @CRLF & @CRLF Local $BytesSent = TCPSend($iSocket, $sCommand) If $BytesSent = 0 Then Return SetError(2, @error, 0) Local $sRecv = "", $sCurrentRecv While 1 $sCurrentRecv = TCPRecv($iSocket, 16) If @error <> 0 Then ExitLoop If $sCurrentRecv <> "" Then $sRecv &= $sCurrentRecv WEnd _HTTPShutdown($iSocket) Return $sRecv EndFunc Func _HTTPConnect($sHost, $iPort=80) TCPStartup() Local $sName_To_IP = TCPNameToIP($sHost) Local $iSocket = TCPConnect($sName_To_IP, $iPort) If $iSocket = -1 Then TCPCloseSocket($iSocket) Return SetError(1, 0, "") EndIf Return $iSocket EndFunc Func _HTTPShutdown($iSocket) TCPCloseSocket($iSocket) TCPShutdown() EndFunc Thanks MrCreatoR! The code work fine.
ccbamatx Posted March 7, 2010 Posted March 7, 2010 (edited) MrCreatoR...... when I use that piece of code, I sometimes get extra characters in the reply... which I do not think belong there... namely the "fef", "bbc" (in the middle of the reply string) and "0" character at the end. This appears to be very sporadic. The first time I ran your code, it worked perfectly. Subsequent times, it starting returning these characters....then I ran it again and it worked perfectly.... I was monkeying with the maxlen parameter. I have worked on this for about a week switching from ascii to binary and back. Any ideas? GOOGLE RESPONSE vi MrCreatoR's _HTTPGet: ----------------------------------------------------------------------------------------------------------------------------- HTTP/1.1 200 OK Date: Sun, 07 Mar 2010 20:51:54 GMT Expires: -1 Cache-Control: private, max-age=0 Content-Type: text/html; charset=UTF-8 Set-Cookie: PREF=ID=ad7335fca99c3610:TM=1267995113:LM=1267995114:S=F3Reb2laG0sOrmNC; expires=Tue, 06-Mar-2012 20:51:54 GMT; path=/; domain=.google.com Set-Cookie: NID=32=FdYb2qFmaAyGiNmmmX-KOcdPFM32kYASypwyHfFiEFTq2yhGHuQKW2Tr0GxEZWKqCKcTnfQXN9KK1mPYfh8UmCHFPu4fy8eqWfl5WVKx8OXe8ejveZfMYR-zkanjIjyQ; expires=Mon, 06-Sep-2010 20:51:54 GMT; path=/; domain=.google.com; HttpOnly Server: gws X-XSS-Protection: 0 Transfer-Encoding: chunked Connection: close fef <!doctype html><html onmousemove="google&&google.fade&&google.fade(event)"><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Google</title><script>window.google={kEI:"6RGUS6LYPKGEeKP01YUN",kEXPI:"23729,24025",kCSI:{e:"23729,24025",ei:"6RGUS6LYPKGEeKP01YUN",expi:"23729,24025"},ml:function(){},pageState:"#",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,j:{en:1,l:function(){},e:function(){},b:location.hash&&location.hash!="#",pl:[],mc:0,sc:0.5},Toolbelt:{}};(function(){for(var d=0,c;c=["ad","bc","p","pa","zd","ac","pc","pah","ph","sa","xx","zc","zz"][d++](function(a){google.j[a]=function(){google.j.pl.push([a,arguments])}})©})(); window.google.sn="webhp";window.google.timers={load:{t:{start:(new Date).getTime()}}};try{window.google.pt=window.gtbExternal&&window.gtbExternal.pageT();}catch(u){}window.google.jsrt_kill=1; </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;}#fctr,#ghead,#pmocntr,#sbl,#tba,#tbe,.fade{opacity:0;}#fctr,#ghead,#pmocntr,#sbl,#tba,#tbe,.fade{background:#fff;}#gbar{float:left;height:22px}.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}#guser{padding-bottom:7px !important;text-align:right}#gbar,#guser{font-size:13px;padding-top:1px !important}.gb1{margin-right:.5em}.gb1,.gb3{zoom:1}.gb2{display:block;padding:.2em .5em}.gb2,.gb3{text-decoration:none}a.gb1,a.gb2,a.gb3,a.gb4{color:#00c !important}a.gb2:hover{background:#36c;color:#fff !important}</style><noscript><style>#fctr,#ghead,#pmocntr,#sbl,#tba,#tbe,.fade{opacity:1;}</style></noscript><script>var _gjwl=location;function _gjuc(){var b=_gjwl.href.indexOf("#");if(b>=0){var a=_gjwl.href.substring(b+1);if(/(^|&)q=/.test(a)&&a.indexOf("#")==-1&&!/(^|&)cad=h($|&)/.test(a)){_gjwl.replace("/search?"+a.replace(/(^|&)fp=[^&]*/g,"")+"&cad=h");return 1}}return 0}function _gjp(){!(window._gjwl.hash&&window._gjuc())&&setTimeout(_gjp,500)}; google.y={};google.x=function(e,g){google.y[e.id]=[e,g];return false};if(!window.google)window.google={};window.google.crm={};window.google.cri=0;window.clk=function(d,e,f,j,k,l,m){if(document.images){var a=encodeURIComponent||escape,b=new Image,g=window.google.cri++;window.google.crm[g]=b;b.onerror=(b.onload=(b.onabort=function(){delete window.google.crm[g]}));b.src=["/url?sa=T","",e?"&oi="+a(e):"",f?"&cad="+a(f):"","&ct=",a(j||"res"),"&cd=",a(k),"&ved=",a(m),d?"&url="+a(d.replace(/#.*/,"")).replace(/\+/g,"%2B"):"","&ei=","6RGUS6LYPKGEeKP01YUN",l].join("")} return true}; window.gbar={qs:function(){},tg:function(e){var o={id:'gbar'};for(i in e)o=e;google.x(o,function(){gbar.tg(o)})}};</script></head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="try{!google.j.b&&document.f.q.focus()}catch(e){};if(document.images)new Image().src='/images/nav_logo7.png'" topmargin=3 marginheight=3><textarea id=csi style=display:none></textarea><script>if(google.j.document.body.style.visibility='hidden';</script><iframe name=wgjf style=display:none src="" onload="google.j.l()" onerror="google.j.e()"></iframe><textarea id=wgjc style=display:none></textarea><textarea id=csi style=display:none></textarea><textarea id=hcache style=display:none></textarea><span id=main><div id=ghead><div id=gbar><nobr><b class=gb1>Web</b> <a href="http://images.google.c fef om/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><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> | <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><span id=body><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 onsubmit="google.fade=null"><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 autocomplete="off" onblur="google&&google.fade&&google.fade()" maxlength=2048 name=q size=55 class=lst title="Google Search" value=""><br><input name=btnG type=submit value="Google Search" class=lsb onclick="this.checked=1"><input name=btnI type=submit value="I'm Feeling Lucky" class=lsb onclick="this.checked=1"></td><td nowrap width=25% align=left id=sbl><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></center></span> <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> </span> <script>function _gjp() {!(location.hash && _gjuc()) && setTimeout(_gjp, 500);}google.j[1]={cc:[],co:['ghead','body','footer','xjsi'],pc:[],nb:0,css:document.getElementsByTagName('style')[0].innerHTML,main:'<div id=ghead></div><span id=body></span><span id=footer></span><span id=xjsi></span>'};</script><script>function wgjp(){var xjs=document.createElement('script');xjs.src='/extern_chrome/744a3c8a556db bbc 445.js';(document.getElementById('xjsd') || document.body).appendChild(xjs)};</script><div id=xjsd></div><div id=xjsi><script>if(google.y)google.y.first=[];if(google.y)google.y.first=[];if(!google.xjs){google.dstr=[];google.rein=[];window.setTimeout(function(){var a=document.createElement("script");a.src="/extern_js/f/CgJlbhICdXMrMAo4XUAILCswDjgMLCswFjgXLCswFzgGLCswGDgFLCswGTgXLCswHTgkLCswJTjKiAEsKzAmOAksKzAnOAQsKzAqOAMsKzArOAosKzA8OAIsKzBAOAssKzBEOAIsKzBFOAEs/Je5yR72NtSU.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.xjs=1};google.neegg=1;google.y.first.push(function(){(function(){ function b(a){document.cookie=a}function c(){if(!document.cookie.match(/GZ=Z=[0,1]/)){b("GZ=Z=0");var a=document.createElement("iframe");a.src="/compressiontest/gzip.html";a.style.display="none";(document.getElementById("xjsd")||document.body).appendChild(a)}}c(); })() ;google.ac.m=1;google.ac.b=true;google.ac.i(document.f,document.f.q,'','','',{o:1});(function(){ var g,h,i=1,k=google.time();google.rein.push(function(){i=1;k=google.time()});google.dstr.push(function(){google.fade=null});function l(c,e){var a=[];for(var b=0,d;d=c[b++]{var f=document.getElementById(d);f&&a.push(f)}for(var b=0,j;j=e[b++];)a=a.concat(m(j[0],j[1]));for(var b=0;a;b++)a=[a,"opacity",0,1,0,""];return a}function m(c,e){var a=[],b=0,d,f=document.getElementsByTagName©;for(;d=f[b++];)d.className== e&&a.push(d);return a}google.fade=function©{if(google.fx&&i){c=c||window.event;var e=1,a=google.time()-k;if(c&&c.type=="mousemove"){var b=c.clientX,d=c.clientY;e=(g||h)&&(g!=b||h!=d)&&a>600;g=b;h=d}if(e){i=0;google.fx.animate(600,l(["fctr","ghead","pmocntr","sbl","tba","tbe"],[["span","fade"],["div","fade"],["div","gbh"]]))}}}; })(); ;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> 0 Edited March 7, 2010 by ccbamatx
MrCreatoR Posted March 8, 2010 Posted March 8, 2010 ccbamatxI can not reproduce the result that you get, are you sure that you are using the same example? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
ccbamatx Posted March 8, 2010 Posted March 8, 2010 ccbamatxI can not reproduce the result that you get, are you sure that you are using the same example?Yes I am. Positive.... but I also do not think it is your script. I have looked at Wireshark and I am seeing it come in. I think it has something to do with my Cisco VPN... or something. Problem is that I can't make it happen and can't make it stop when it does happen.At my office, it happens on both my PCs. At my home, it sometimes happens and sometimes does not happen on my laptop.I really hate these obscure problems.Thanks for your reply.CCB
ccbamatx Posted March 8, 2010 Posted March 8, 2010 (edited) ...after countless hours... I think it has something to do with "Transfer-Encoding: chunked" I noticed that ie and Firefox are receiving their responses as "Content-Encoding: gzip" Can you tell me how to check this and possibly fix it? Thanks, CCB Follow-up.. I was correct. It is Chunked Transfer-Encoding. The fix is to originate the request in HTTP 1.0. Otherwise, the server makes the choice. Edited March 8, 2010 by ccbamatx
MrCreatoR Posted March 8, 2010 Posted March 8, 2010 you can try and set the headers: .... Local $sCommand = "GET " & $sPage & " HTTP/1.1" & @CRLF $sCommand &= "Host: " & $sHost & @CRLF $sCommand &= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0" & @CRLF $sCommand &= "Referer: " & $sHost & @CRLF $sCommand &= "Content-Encoding: gzip" & @CRLF $sCommand &= "Connection: close" & @CRLF & @CRLF .... Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
ccbamatx Posted March 8, 2010 Posted March 8, 2010 Thanks MrCreatoR for you help. I think the solution is to transmit in HTTP 1.0
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now