DaProgrammer Posted December 31, 2007 Share Posted December 31, 2007 i need to benchmark my bosses site load time in comparison to other sites so i wrote this little script: #include <IE.au3> $oIE = _IECreate ("http://www.google.com",0,0) $Timer = TimerInit() For $i = 1 to 10 _IENavigate ($oIE, "http://www.curver.com") Next $curver = TimerDiff($Timer) $Timer = 0 $curver = $curver/10 $Timer = TimerInit() For $i = 1 to 10 _IENavigate ($oIE, "http://www.ynet.co.il") Next $ynet = TimerDiff($Timer) $Timer = 0 $ynet = $ynet/10 $Timer = TimerInit() For $i = 1 to 10 _IENavigate ($oIE, "http://www.google.com") Next $google = TimerDiff($Timer) $Timer = 0 $google = $google/10 _IEQuit($oIE) MsgBox(0, "Time:", "www.Curver.com - " & Round($curver/1000,2) & @CRLF & "www.ynet.co.il - " & Round($ynet/1000,2) & @CRLF & "www.google.com - " & Round($google/1000,2) ) i need to test the time the site loads from europe and not israel so i thought of using a european proxy to do this. my question is it possible to surf an adrees via proxy from autoit ? Link to comment Share on other sites More sharing options...
ptrex Posted December 31, 2007 Share Posted December 31, 2007 @DaProgrammer Something like this should get you going. expandcollapse popup;set parameters for using Global $UseIntegratedSecurity = False Global $ProxyServer = "10.0.0.1:8080" Global $ProxyUser = "username" ;if $UseIntegratedSecurity is true (and working), these can be blank Global $ProxyPass = "password" ;create WinHttpRequest object for downloading config info Global $oHttp = ObjCreate ("WinHttp.WinHttpRequest.5.1") $oHttp.SetProxy(2,$ProxyServer) ; PRECONFIG = 0 (default), DIRECT = 1, PROXY = 2 $sHTML = httpget("http://www.google.com") ConsoleWrite($sHTML & @CRLF) func httpget($url) $COMerrnotify = false If $UseIntegratedSecurity Then $oHttp.SetAutoLogonPolicy(0) ; Always = 0, OnlyIfBypassProxy = 1, Never = 2 Else $oHttp.SetAutoLogonPolicy(2) ; Always = 0, OnlyIfBypassProxy = 1, Never = 2 EndIf $status = $oHttp.Open("GET", $url,false) If Not $UseIntegratedSecurity Then $oHttp.SetCredentials($ProxyUser,$ProxyPass,0) ; HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0 EndIf $oHttp.Send() if $oHttp.Status <> "200" then $status = $oHttp.Status $StatusText = $oHttp.StatusText Consolewrite("Status: " & $status & @crlf) Consolewrite("StatusText: " & $StatusText & @crlf) $COMerrnotify = true SetError(1) return $status & " - " & $StatusText Else $COMerrnotify = true SetError(0) Consolewrite("Response Headers: " & $oHttp.GetAllResponseHeaders & @crlf) return $oHttp.ResponseText EndIf EndFunc ;_IEErrorHandlerRegister("ComErrFunc") $oIEErrorHandler = ObjEvent("AutoIt.Error","ComErrFunc") global $COMerrnotify = true Func ComErrFunc() If IsObj($oIEErrorHandler) Then if $COMerrnotify then ConsoleWrite("--> ComErrFunc: COM Error Encountered in " & @ScriptName & @CR) ConsoleWrite("----> Scriptline = " & $oIEErrorHandler.scriptline & @CR) ConsoleWrite("----> Number Hex = " & Hex($oIEErrorHandler.number, 8) & @CR) ConsoleWrite("----> Number = " & $oIEErrorHandler.number & @CR) ConsoleWrite("----> Win Description = " & StringStripWS($oIEErrorHandler.WinDescription, 2) & @CR) ConsoleWrite("----> Description = " & StringStripWS($oIEErrorHandler.description, 2) & @CR) ConsoleWrite("----> Source = " & $oIEErrorHandler.Source & @CR) ConsoleWrite("----> Help File = " & $oIEErrorHandler.HelpFile & @CR) ConsoleWrite("----> Help Context = " & $oIEErrorHandler.HelpContext & @CR) ConsoleWrite("----> Last Dll Error = " & $oIEErrorHandler.LastDllError & @crlf) EndIf $HexNumber = Hex($oIEErrorHandler.number, 8) SetError($HexNumber) Else SetError(1) EndIf Return 0 EndFunc regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
karman Posted December 31, 2007 Share Posted December 31, 2007 Just set a proxy in internet explorer, in the connections tab.. Link to comment Share on other sites More sharing options...
DaProgrammer Posted December 31, 2007 Author Share Posted December 31, 2007 @DaProgrammer Something like this should get you going. expandcollapse popup;set parameters for using Global $UseIntegratedSecurity = False Global $ProxyServer = "10.0.0.1:8080" Global $ProxyUser = "username" ;if $UseIntegratedSecurity is true (and working), these can be blank Global $ProxyPass = "password" ;create WinHttpRequest object for downloading config info Global $oHttp = ObjCreate ("WinHttp.WinHttpRequest.5.1") $oHttp.SetProxy(2,$ProxyServer) ; PRECONFIG = 0 (default), DIRECT = 1, PROXY = 2 $sHTML = httpget("http://www.google.com") ConsoleWrite($sHTML & @CRLF) func httpget($url) $COMerrnotify = false If $UseIntegratedSecurity Then $oHttp.SetAutoLogonPolicy(0) ; Always = 0, OnlyIfBypassProxy = 1, Never = 2 Else $oHttp.SetAutoLogonPolicy(2) ; Always = 0, OnlyIfBypassProxy = 1, Never = 2 EndIf $status = $oHttp.Open("GET", $url,false) If Not $UseIntegratedSecurity Then $oHttp.SetCredentials($ProxyUser,$ProxyPass,0) ; HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0 EndIf $oHttp.Send() if $oHttp.Status <> "200" then $status = $oHttp.Status $StatusText = $oHttp.StatusText Consolewrite("Status: " & $status & @crlf) Consolewrite("StatusText: " & $StatusText & @crlf) $COMerrnotify = true SetError(1) return $status & " - " & $StatusText Else $COMerrnotify = true SetError(0) Consolewrite("Response Headers: " & $oHttp.GetAllResponseHeaders & @crlf) return $oHttp.ResponseText EndIf EndFunc ;_IEErrorHandlerRegister("ComErrFunc") $oIEErrorHandler = ObjEvent("AutoIt.Error","ComErrFunc") global $COMerrnotify = true Func ComErrFunc() If IsObj($oIEErrorHandler) Then if $COMerrnotify then ConsoleWrite("--> ComErrFunc: COM Error Encountered in " & @ScriptName & @CR) ConsoleWrite("----> Scriptline = " & $oIEErrorHandler.scriptline & @CR) ConsoleWrite("----> Number Hex = " & Hex($oIEErrorHandler.number, 8) & @CR) ConsoleWrite("----> Number = " & $oIEErrorHandler.number & @CR) ConsoleWrite("----> Win Description = " & StringStripWS($oIEErrorHandler.WinDescription, 2) & @CR) ConsoleWrite("----> Description = " & StringStripWS($oIEErrorHandler.description, 2) & @CR) ConsoleWrite("----> Source = " & $oIEErrorHandler.Source & @CR) ConsoleWrite("----> Help File = " & $oIEErrorHandler.HelpFile & @CR) ConsoleWrite("----> Help Context = " & $oIEErrorHandler.HelpContext & @CR) ConsoleWrite("----> Last Dll Error = " & $oIEErrorHandler.LastDllError & @crlf) EndIf $HexNumber = Hex($oIEErrorHandler.number, 8) SetError($HexNumber) Else SetError(1) EndIf Return 0 EndFuncoÝ÷ Ú· j·l¦ÚÞÇú®¢×Éú+¶«zrnëm+"±¦âµÊ&¦Xjײ¥ww*.®¥¦»§)ඬéíz·¶©®rjwië,yÑynëbµê뢽ý²åw·Ñ«¢+ÙèÀäÈí½Õµ¹Ñ̹MÑÑ¥¹ÌÀäÈí-(ÀäÈíÍѽÀÀäÈíÁɽ©ÐŹÔÌ ÌÀ¤èôôÐìQ¡ÉÅÕÍÑÑ¥½¸Ý¥Ñ Ñ¡¥Ì½©Ð¡Ì¥±¸è(ÀÌØí½!ÑÑÀ¹M¹ ¤(ÀÌØí½!ÑÑÀ¹M¹ ¥xII=H Link to comment Share on other sites More sharing options...
Armand Posted January 1, 2008 Share Posted January 1, 2008 And how do u do it with TCP sends ?!here: http://www.autoitscript.com/forum/index.ph...p;hl=proxy+surf [u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?! Link to comment Share on other sites More sharing options...
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