Jump to content

Having issues reading a web page source (weird)


Morthawt
 Share

Recommended Posts

#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.

Link to comment
Share on other sites

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 by Morthawt
Link to comment
Share on other sites

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 by HeJake
Link to comment
Share on other sites

Huh, I have always had to add the True part at the end. I never considered I would have to remove that ?!

Thanks

Edited by Morthawt
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...