fielmann Posted May 2, 2008 Share Posted May 2, 2008 Hello, how to read get the info from a website about PHPSESSID without using IE or Firefox? Any ideas? Link to comment Share on other sites More sharing options...
ProgAndy Posted May 2, 2008 Share Posted May 2, 2008 (edited) use wininet dll: http://support.microsoft.com/kb/196062/en-us/This works till you need javascript Edited May 2, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
fielmann Posted May 3, 2008 Author Share Posted May 3, 2008 use wininet dll: http://support.microsoft.com/kb/196062/en-us/This works till you need javascript Can you give me an autoit-example how to use the wininet.dll with cookies and phpsessid? Link to comment Share on other sites More sharing options...
ProgAndy Posted May 3, 2008 Share Posted May 3, 2008 OK, heres an example expandcollapse popup#include <IE.au3> ; IE is just used to show the resulting HTML :) $oIE = _IECreate() ;OPEN Internet Local $h_DLL = DllOpen("wininet.dll") 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 ;------------------------------- ; OPen Page 1 $s_URL = "http://progandy.pr.funpic.de/session/session1.php" $s_Header = '' 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 ;--------------------------- ; Read Page content Local $s_Buf = "" 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 ;---------------------- MsgBox(0, '', $s_Buf) _IEDocWriteHTML($oIE,$s_Buf) ; Read COOKIES Local $v2_Struct = DllStructCreate('char[500]') $TheCookie = DllCall($h_DLL,"int","InternetGetCookie","str",$s_URL,"str","","ptr",DllStructGetPtr($v2_Struct),"dword*",500) $AllcookiesInString = DllStructGetData($v2_Struct, 1) ; --------------- MsgBox(0, "Cookies", $AllcookiesInString) ; Close Handle to page DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IOU[0]) ;-------------------- ; The cookie stys there for the whole Script ; OPen Page 2 $s_URL = "http://progandy.pr.funpic.de/session/session2.php" 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 ;----------------------- ; Read Page content Local $s_Buf = "" 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 MsgBox(0, '', $s_Buf) _IEDocWriteHTML($oIE,$s_Buf) ; ------------------------------------- ; Close Pge 2 DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IOU[0]) ; ------------ ;######## OPen page2 again: ; The cookie stys there for the whole Script ; OPen Page 2 $s_URL = "http://progandy.pr.funpic.de/session/session2.php" 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 ;----------------------- ; Read Page content Local $s_Buf = "" 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 MsgBox(0, '', $s_Buf) _IEDocWriteHTML($oIE,$s_Buf) ; ------------------------------------- ; Close Pge 2 DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IOU[0]) ; ------------ ;######################## ; Close Internt ; THe cookie rests in System-Cookie Cache, if it has an expiration date, otherwise, it will be deleted. DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0]) DllClose($h_DLL) ; --------------- *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
fielmann Posted May 3, 2008 Author Share Posted May 3, 2008 wininet.dll seems to be all I need The example looks good Where can I find all commands that I can call with wininet.dll ? Can you also send me a link to documentation of wininet.dll ? Link to comment Share on other sites More sharing options...
oren Posted September 21, 2008 Share Posted September 21, 2008 (edited) Great Example of wininet.dll ProgAndy... fielmann all documentation about wininet dll can be found in here http://msdn.microsoft.com/en-us/library/aa383630(VS.85).aspx Edited September 21, 2008 by oren Link to comment Share on other sites More sharing options...
Akton Posted October 6, 2009 Share Posted October 6, 2009 Pity autoit doesn't just support cookies out of the box. Link to comment Share on other sites More sharing options...
russell Posted November 24, 2010 Share Posted November 24, 2010 (edited) Dead link on all commands. Can someone give a working one? correction the link didnt include.aspx Edited November 24, 2010 by russell muppet hands are so soft :) 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