Morthawt Posted September 17, 2013 Share Posted September 17, 2013 #include <String.au3> #include <Inet.au3> HttpSetUserAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0") $URL = 'http://www.worldoftanks-wot.com/mods/' $sSource = _INetGetSource($URL, True) ConsoleWrite($sSource) $sSource = BinaryToString(InetRead($URL, 1)) ConsoleWrite($sSource) I have read source code into a variable more times than I can count. Right now the url: http://www.worldoftanks-wot.com/mods/ will not let me view the source code, even putting in a standard browser agent string. I cannot fathom what would be preventing this? I have tried two different methods to get the source code. Free and easy Autoit scripting video tutorials (plus more videos always coming!) General video tutorials, especially correct and safe TeamSpeak permissions tutorials. Link to comment Share on other sites More sharing options...
HeJake Posted September 17, 2013 Share Posted September 17, 2013 This should work $URL = "http://www.worldoftanks-wot.com/mods/" $oHTTP = ObjCreate('winhttp.winhttprequest.5.1') $oHTTP.Open('GET', $URL, False) $oHTTP.Send() $oHTTP.WaitForResponse $HTTPSource = $oHTTP.Responsetext MsgBox(0, '', $HTTPSource) Link to comment Share on other sites More sharing options...
Morthawt Posted September 17, 2013 Author Share Posted September 17, 2013 (edited) See I don't use that side of Autoit. Do you have any ideas why the classic types of approach won't retrieve the source code? I have never had this happen before. It is mind boggling. Edited September 17, 2013 by Morthawt Free and easy Autoit scripting video tutorials (plus more videos always coming!) General video tutorials, especially correct and safe TeamSpeak permissions tutorials. Link to comment Share on other sites More sharing options...
HeJake Posted September 17, 2013 Share Posted September 17, 2013 (edited) Well, you can also try this one: #include <IE.au3> $GUI = GUICreate('', 0, 0, 0, 0) $oIE = _IECreateEmbedded() GUICtrlCreateObj($oIE, -1, -1, 0, 0) GUISetState(@SW_HIDE) _IENavigate($oIE, $URL) $sSource = _IEDocReadHTML($oIE) MsgBox(0, '', $sSource) There might be some script causes you to not receive source code using your way. Blame on me, this works: #include <String.au3> #include <Inet.au3> HttpSetUserAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0") $URL = 'http://www.worldoftanks-wot.com/mods' $sSource = _INetGetSource($URL) ConsoleWrite($sSource) Edited September 17, 2013 by HeJake Link to comment Share on other sites More sharing options...
Morthawt Posted September 17, 2013 Author Share Posted September 17, 2013 (edited) Huh, I have always had to add the True part at the end. I never considered I would have to remove that ?! Thanks Edited September 17, 2013 by Morthawt Free and easy Autoit scripting video tutorials (plus more videos always coming!) General video tutorials, especially correct and safe TeamSpeak permissions tutorials. Link to comment Share on other sites More sharing options...
HeJake Posted September 17, 2013 Share Posted September 17, 2013 (edited) No, you can keep that flag (but source code will be returned as string anyway if you remove it), the problem was with the last slash (/) http://www.worldoftanks-wot.com/mods/ to http://www.worldoftanks-wot.com/mods Edited September 17, 2013 by HeJake Link to comment Share on other sites More sharing options...
Morthawt Posted September 17, 2013 Author Share Posted September 17, 2013 Well thanks for letting me know, I have never run into that issue before. Thanks. Free and easy Autoit scripting video tutorials (plus more videos always coming!) General video tutorials, especially correct and safe TeamSpeak permissions tutorials. 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