goldenix Posted May 6, 2008 Share Posted May 6, 2008 I use IE to log in & then i use this code to get page source, but the problem is that according to the source I get, im not logged in.Hire is sample if someone is unable to understand:When logged in Source code has word letters in itIf not logged in source code does not have word letters in itI want to get that word letters, so why im getting the source code without letters, even tho i logged in with IE?Do i need to use this ObjCreate thing to log in somehow?;================================= $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET",'http://www.sampleurl.com) $oHTTP.Send() ;================================= $HTMLSource = $oHTTP.Responsetext My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list] Link to comment Share on other sites More sharing options...
weaponx Posted May 6, 2008 Share Posted May 6, 2008 Wait a minute, so you open an IE window, login, then run this script? If thats the case you probably won't get the contents of the logged in page since you are basically opening two seperate sessions. Link to comment Share on other sites More sharing options...
goldenix Posted May 6, 2008 Author Share Posted May 6, 2008 (edited) Wait a minute, so you open an IE window, login, then run this script? If thats the case you probably won't get the contents of the logged in page since you are basically opening two seperate sessions. Yes you understood correctly. So its impossible to get that logged in page source code with this kind of code? Or maybe its possible to merge those 2 sessions somehow? no?The reason i use this code cuz its Insanely fast. I tried other code with _IEBodyReadHTML but that one takes 10+ seconds to get the code Edited May 6, 2008 by goldenix My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list] Link to comment Share on other sites More sharing options...
weaponx Posted May 6, 2008 Share Posted May 6, 2008 You probably have to use _IEAttach to attach to the instance you already have open. The only other way is using WinHttpRequest to POST the correct headers containing valid session information. Link to comment Share on other sites More sharing options...
goldenix Posted May 6, 2008 Author Share Posted May 6, 2008 You probably have to use _IEAttach to attach to the instance you already have open. The only other way is using WinHttpRequest to POST the correct headers containing valid session information._IE attach is no good, (it will be long to explain why.) Would you mind making 1 small sample code how to do the post headers thing, so I could experiment with it? My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list] Link to comment Share on other sites More sharing options...
DaleHohm Posted May 6, 2008 Share Posted May 6, 2008 _IE attach is no good, (it will be long to explain why.)I'd be interested in why...Dale 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 Link to comment Share on other sites More sharing options...
AU3Newbie Posted May 7, 2008 Share Posted May 7, 2008 (edited) I'd be interested in why...Dale1)He means the speed.Speed first.funtion 2nd.I'm agree with him.2)Object will give him a good solution to every Program language,his code will be easily transplanted.It's also a good news to me,too. Edited May 7, 2008 by AU3Newbie Link to comment Share on other sites More sharing options...
DaleHohm Posted May 7, 2008 Share Posted May 7, 2008 1)He means the speed.Speed first.funtion 2nd.I'm agree with him.2)Object will give him a good solution to every Program language,his code will be easily transplanted.It's also a good news to me,too.I'm not sure your assumption is correct. If the IE session does not already exist, then yes, the IE functions pay the cost of starting IE. If the browser is already running and pointed to the desired site then speed is not likely the issue (you are accessing locally cached data at that point so there is not even a trip to the server).Dale 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 Link to comment Share on other sites More sharing options...
weaponx Posted May 7, 2008 Share Posted May 7, 2008 Every page handles login info differently but here is an example. This should authenticate a username and password and if they are correct redirect you to Google. You should see the Google html source output to the console. $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "http://www.fallenstar.net/fakelogin.php") $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.Send("username=Username&password=Password") ConsoleWrite($oHTTP.ResponseText & @CRLF) Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription ) SetError(1) Endfunc Link to comment Share on other sites More sharing options...
goldenix Posted May 7, 2008 Author Share Posted May 7, 2008 Every page handles login info differently but here is an example. This should authenticate a username and password and if they are correct redirect you to Google. You should see the Google html source output to the console. I was thinking & thinking & more thinking.. so I went to bed & i see things bit more clearly now. _IEAttach does work (so i simply do controlsend URL to IE to refresh the page & get new source & it can work in the background then, but this still means I must wait until IE loads.) Code: #include <IE.au3> _IECreate('http://www.autoitscript.com/') $oIE = _IEAttach ("AutoIt"); Attach to a browser with "AutoIt" in its title, display the URL $HTMLSource = _IEPropertyGet ($oIE, "outerhtml") clipput($HTMLSource)oÝ÷ Øuë^iÇ(º{ZázZ zZë(º·µée²g+¡×ºÒÇ+mÊ My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list] 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