Jump to content

Surf to website, fill in a form, get data without opening browser?


Recommended Posts

Hi,

this is what my program does when it has to fetch data from a website:

Step 1:

Open an invisible IE window and it surfes to a website:

;code

$oIE = _IECreate(0)
_IENavigate($oIE, 'http://localhost/~ OSS ~/search.php')

;code

Step 2:

Fill in a form, submit the form, get the source and quit IE:

;code

$oIE.document.forms(0).elements(0).value = $y
$oIE.document.forms(0).submit()
Sleep(350)
$source = _IEBodyReadHTML($oIE)
_IEQuit($oIE)

;code

Step 3:

Puts the source in a txt-file:

;code

$filec = _FileCreate(@ScriptDir & "\Files\test.txt")
$file = FileOpen(@ScriptDir & "\Files\test.txt", 1)   
FileWrite($file, $source)
FileClose($filec)

;code

This works perfectly, but the process iexplore.exe is running when the program is fetching the data, it isn't visible, but now i want to make the first two steps (Step 1 and Step 2) even without iexplore.exe... So my question is, how can I mak this? Is it possible with DLL files or some other things?

Cheers,

Andreas

//Edit, in my script i use v1.0 of DaleHohm's IE.au3, i prefer this version to v2.0

Edited by Noobster24
Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc.
Link to comment
Share on other sites

Okay, now i have this script so far:

$dll = DllOpen ("C:\WINDOWS\system32\wininet.dll")
$param1 = "Microsoft Internet Explorer"
$param2 = "INTERNET_OPEN_TYPE_DIRECT"
$go = DllCall ($dll, "int", "InternetOpen", "str", $param1, "str", $param2)
DllClose($dll)

But how can i find the handle returned by InternetOpen? Because the 'InternetOpenUrl' needs the handle returned by InternetOpen...

Edited by Noobster24
Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc.
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...