Sign in to follow this  
Followers 0
raedts

Download ASPX page

6 posts in this topic

I want to create a small program with tells you information about a car by typing in it's numberplate.

I want to use the page of the dutch RDW, the problem is its ASPX, anyone know how to download the page i need.

http://info.apk.nl/ovi/oviinvoer.aspx

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

after a bit of messing around this seems to work:

MsgBox(0, 'Raw HTML', _GetInfo('33-bl-lk'))

Func _GetInfo($s_Plate)
    $s_VIEWSTATE = _INetGetSource("http://info.apk.nl/ovi/oviinvoer.aspx")
    $s_VIEWSTATE = StringRegExp($s_VIEWSTATE, '<input type="hidden" name="__VIEWSTATE" value="(.*?)" />', 1)
    Return _INetGetSource("http://info.apk.nl/ovi/oviinvoer.aspx?btnZoeken=Zoeken&txtKenteken=" & StringUpper($s_Plate) & "&__VIEWSTATE=" & $s_VIEWSTATE[0])
EndFunc   ;==>_GetInfo


Func _INetGetSource($s_URL, $s_Header = '')
    If StringLeft($s_URL, 7) <> 'http://' And StringLeft($s_URL, 8) <> 'https://' Then $s_URL = 'http://' & $s_URL
    Local $h_DLL = DllOpen("wininet.dll")
    Local $ai_IRF, $s_Buf = ''
    Local $ai_IO = DllCall($h_DLL, 'int', 'InternetOpen', 'str', "AutoIt v3", 'int', 0, 'int', 0, 'int', 0, 'int', 0)
    If @error Or $ai_IO[0] = 0 Then
        DllClose($h_DLL)
        SetError(1)
        Return ""
    EndIf
    Local $ai_IOU = DllCall($h_DLL, 'int', 'InternetOpenUrl', 'int', $ai_IO[0], 'str', $s_URL, 'str', $s_Header, 'int', StringLen($s_Header), 'int', 0x80000000, 'int', 0)
    If @error Or $ai_IOU[0] = 0 Then
        DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0])
        DllClose($h_DLL)
        SetError(1)
        Return ""
    EndIf
    Local $v_Struct = DllStructCreate('udword')
    DllStructSetData($v_Struct, 1, 1)
    While DllStructGetData($v_Struct, 1) <> 0
        $ai_IRF = DllCall($h_DLL, 'int', 'InternetReadFile', 'int', $ai_IOU[0], 'str', '', 'int', 256, 'ptr', DllStructGetPtr($v_Struct))
        $s_Buf &= StringLeft($ai_IRF[2], DllStructGetData($v_Struct, 1))
    WEnd
    DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IOU[0])
    DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0])
    DllClose($h_DLL)
    Return $s_Buf
EndFunc   ;==>_INetGetSource
Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Share this post


Link to post
Share on other sites

I want to create a small program with tells you information about a car by typing in it's numberplate.

I want to use the page of the dutch RDW, the problem is its ASPX, anyone know how to download the page i need.

http://info.apk.nl/ovi/oviinvoer.aspx

The form functions and table functions in IE.au3 could make short work of that. See

_IECreate,

_IEFormGetObjByName,

_IEFormElementGetObjByName,

_IEFormElementSetValue

_IEFormSubmit...

then on the new page

_IETableGetCollection,

_IETableWriteToArray

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

Share this post


Link to post
Share on other sites

hmm looks verry interesting, thank you w0uter... i will let you know when it's done :D

Share this post


Link to post
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
Sign in to follow this  
Followers 0