Bkid Posted June 25, 2009 Posted June 25, 2009 (edited) So I've just started using AutoIt, and it's kind of confusing..Basically, I want to make a script that logs into a website, but the website sends the login info via https. That being said, I'm assuming regular winhttp isn't going to do the trick.Now, should I try WinINet as an alternative? The WinINet thread (here) mentioned https in the title, but I wasn't sure how to go about using it..I know this might sound like something big to start off on, but I enjoy a challenge. Also, I hope it's not something obvious. It's now 6am so I might have missed something obvious. :/ Edited June 25, 2009 by Bkid
10031992 Posted June 25, 2009 Posted June 25, 2009 I also need this -------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program
Bkid Posted June 25, 2009 Author Posted June 25, 2009 From what I've heard, IE Functions are slow. Isn't there any alternative in autoit?
ProgAndy Posted June 25, 2009 Posted June 25, 2009 WinHTTP does support HTTPS, but it is not trivial: MSDN *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Bkid Posted June 25, 2009 Author Posted June 25, 2009 Oh wow yeah.. It looks like you have to go though a bit more, but as long as it works then I'm willing to do it.
DaleHohm Posted June 25, 2009 Posted June 25, 2009 (edited) From what I've heard, IE Functions are slow. Isn't there any alternative in autoit?Balderdash! Hearsay! Unfounded drivel!That said , browser creation can be considered slow but once that is accomplished things work quite fast. If you don't need client-side processing, a content layout engine, authentication, CSS etc. that are features of a browser then by all means use low level functions like INetGet or direct TCP/IP calls for data. There are many benifits to having access to the browser and browser DOM for other functions.The IE functions work the same for https as they do for http. There are literally thousands of examples in the forum as well as the helpfile. Try Search.DaleEdit: typo Edited June 25, 2009 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
Bkid Posted June 26, 2009 Author Posted June 26, 2009 I'll think about it. In the meantime I'll still keep considering the alternatives.
Authenticity Posted June 26, 2009 Posted June 26, 2009 expandcollapse popup#include <HTTP.au3> Dim $Sock Dim $sHost, $sPage, $sData, $sSrc Dim $sUsername, $sPassword $sUsername = 'MyUserName' $sPassword = 'MyPassWord' $sHost = 'www.autoitscript.com' $sPage = '/forum/index.php?act=Login&CODE=01' $sData = 'referer=http%3A%2F%2Fwww.autoitscript.com%2Fforum%2Findex.php%3Fact%3DLogin%26CODE%3D00&UserName=' & _ _EncodeURL($sUsername) & '&PassWord=' & _EncodeURL($sPassword) & '&CookieDate=1' $Sock = _HTTPConnect($sHost) _HTTPPost($sHost, $sPage, $Sock, $sData) $sSrc = _HTTPRead($Sock) If StringInStr($sSrc, 'attention') Then MsgBox(0x10, 'Attention!', 'The user or password or both are not correct') Else Local $aWelcome = StringRegExp($sSrc, '(?i)<p>You are now logged in as: (.*?)<br\s*/>', 1) If IsArray($aWelcome) Then MsgBox(0x40, 'Welcome', 'You are now logged in as: ' & $aWelcome[0] & @CRLF & 'Please wait while we transfer you...') Else MsgBox(0x40, 'Welcome', ':)') EndIf EndIf _HTTPClose($Sock) Exit Func _EncodeURL($sString) Local $sStr = '' Local $sChr For $i = 1 To StringLen($sString) $sChr = StringMid($sString, $i, 1) If StringRegExp($sChr, '[\w*@-]') Then $sStr &= $sChr Else $sStr &= StringFormat('%%%02X', Asc($sChr)) EndIf Next Return $sStr EndFunc
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