Jump to content

Grab The HTML source


Recommended Posts

  • Moderators

Ok is it possible to make it grab the html source of a URL with out displaying the actual HTML? (using the IE.au3)

I don't know about IE.au3 but what's wrong with _INetGetSource()?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Ok is it possible to make it grab the html source of a URL with out displaying the actual HTML? (using the IE.au3)

_INetGetSource() would be the most efficient way for you to get the source. If you need IE.au3 (for example if the page source you want is not a static page, but the result of some clicking or form submission) you can use

$oIE = _IECreate("http://your-url", 0, 0) ; URL, don't tryAttach, invisble
$pageSource = _IEBodyReadHTML($oIE)
_IEQuit($oIE)

You can also _IEAttach instead of _IECreate, and _IEBodyReadText or _IEDocReadHTML -- see the helpfile for more info.

Dale

Edit: BTW, Example 5 for _IECreate in the helpfile does something similar to this, but returns a specific portion of the page

Edited 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

Link to comment
Share on other sites

_INetGetSource() would be the most efficient way for you to get the source. If you need IE.au3 (for example if the page source you want is not a static page, but the result of some clicking or form submission) you can use

$oIE = _IECreate("http://your-url", 0, 0) ; URL, don't tryAttach, invisble
$pageSource = _IEBodyReadHTML($oIE)
_IEQuit($oIE)

You can also _IEAttach instead of _IECreate, and _IEBodyReadText or _IEDocReadHTML -- see the helpfile for more info.

Dale

Edit: BTW, Example 5 for _IECreate in the helpfile does something similar to this, but returns a specific portion of the page

well i need it to stay logged in. and when i use _INetGetSource it doesnt login. I am going to try it your way.
Link to comment
Share on other sites

also is there any way to speed up the load (when you hide the IE window it still loads all the pictures and runs the script doesnt it?)

Yes, it runs as though it is interactive (because it is). There are registry hacks to turn off image loading and disabling Javascript, but they affect all IE sessions.

You could start it and let it run invisibly and use _IEAttach to connect back to it when needed - then you'd incur the overhead of the initial load only once... just realize it will not exit on it own,

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

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