Sign in to follow this  
Followers 0
karliky

Send POST string to webpage?

8 posts in this topic




Hi

i want to login into a web page:

http://www.votamicuerpo.com/ingresar.php

here is the form:

http://www.votamicuerpo.com/usuario.php

The form send to ingresar.php this posts: nick & pass

it's possible make an script that can "auto login" on the webpage?

i tried with INETv2 but doesn't work :|

(sry for my bad english ._ .)

There is an HTTP.au3 example on the forum capable of this.

There are also some undocumented, prototype functions in IE.au3 in the latest beta that you can look at as well (the functions starting with 2 underscores are undocumented at this time)... here is an example:

#include <IE.au3>
    ; Simulates the submission of the form from the page:
    ;
    ;    http://www.autoitscript.com/forum/index.php?act=Search
    ;
    ; searches for the string safearray and returns the results as posts
    
    $sFormAction = "http://www.autoitscript.com/forum/index.php?act=Search&CODE=01"
    $sHeader = "Content-Type: application/x-www-form-urlencoded"
    
    $sDataToPost = "keywords=safearray&namesearch=&forums%5B%5D=all&searchsubs=1&prune=0&prune_type=newer&sort_key=last_post&sort_order=desc&search_in=posts&result_type=posts"
    $oDataToPostBstr = __IEStringToBstr($sDataToPost) ; convert string to BSTR
    ConsoleWrite(__IEBstrToString($oDataToPostBstr) & @CR) ; prove we can convert it back to a string
    
    $oIE = _IECreate()
    $oIE.Navigate( $sFormAction, Default, Default, $oDataToPostBstr, $sHeader)
    ; or
    ;__IENavigate($oIE, $sFormAction, 1, 0, "", $oDataToPostBstr, $sHeader)

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

#3 ·  Posted (edited)

Hi.

Great!

Is there a way to specify other header content as well?

Accept: image/gif, image/x-xbitmap ....

Referrer: http://www.domain.com/URL/the/form-came-from.html

User-Agent: Mozilla ....

..

..

?

Regards, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

String then together with @CRLF between them. See the W3C spec: http://www.w3.org/Protocols/HTTP/Request.html

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

String then together with @CRLF between them.

Great, didn't expect, that it's that simple :)

Thanks, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

There is an HTTP.au3 example on the forum capable of this.

There are also some undocumented, prototype functions in IE.au3 in the latest beta that you can look at as well (the functions starting with 2 underscores are undocumented at this time)... here is an example:

#include <IE.au3>
    ; Simulates the submission of the form from the page:
    ;
    ;    http://www.autoitscript.com/forum/index.php?act=Search
    ;
    ; searches for the string safearray and returns the results as posts
    
    $sFormAction = "http://www.autoitscript.com/forum/index.php?act=Search&CODE=01"
    $sHeader = "Content-Type: application/x-www-form-urlencoded"
    
    $sDataToPost = "keywords=safearray&namesearch=&forums%5B%5D=all&searchsubs=1&prune=0&prune_type=newer&sort_key=last_post&sort_order=desc&search_in=posts&result_type=posts"
    $oDataToPostBstr = __IEStringToBstr($sDataToPost) ; convert string to BSTR
    ConsoleWrite(__IEBstrToString($oDataToPostBstr) & @CR) ; prove we can convert it back to a string
    
    $oIE = _IECreate()
    $oIE.Navigate( $sFormAction, Default, Default, $oDataToPostBstr, $sHeader)
    ; or
    ;__IENavigate($oIE, $sFormAction, 1, 0, "", $oDataToPostBstr, $sHeader)oÝ÷ Ø Ý-¢·­ëÞ¶LÂåGºÚ"µÍÌÍÕÚ[KÜÛÙU^

Tnx Dale

Share this post


Link to post
Share on other sites

Please see my sig regarding "doesn't work".

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
On 9/14/2008 at 9:25 AM, DaleHohm said:

Thanks Dale. Life saver. I needed this to get TLS 1.2 going for communication.

 

On 9/14/2008 at 9:25 AM, DaleHohm said:

There is an HTTP.au3 example on the forum capable of this.

 

There are also some undocumented, prototype functions in IE.au3 in the latest beta that you can look at as well (the functions starting with 2 underscores are undocumented at this time)... here is an example:

 

 

#include <IE.au3>
    ; Simulates the submission of the form from the page:
    ;
    ;    http://www.autoitscript.com/forum/index.php?act=Search
    ;
    ; searches for the string safearray and returns the results as posts
    
    $sFormAction = "http://www.autoitscript.com/forum/index.php?act=Search&CODE=01"
    $sHeader = "Content-Type: application/x-www-form-urlencoded"
    
    $sDataToPost = "keywords=safearray&namesearch=&forums%5B%5D=all&searchsubs=1&prune=0&prune_type=newer&sort_key=last_post&sort_order=desc&search_in=posts&result_type=posts"
    $oDataToPostBstr = __IEStringToBstr($sDataToPost) ; convert string to BSTR
    ConsoleWrite(__IEBstrToString($oDataToPostBstr) & @CR) ; prove we can convert it back to a string
    
    $oIE = _IECreate()
    $oIE.Navigate( $sFormAction, Default, Default, $oDataToPostBstr, $sHeader)
    ; or
    ;__IENavigate($oIE, $sFormAction, 1, 0, "", $oDataToPostBstr, $sHeader)

 

Dale

 


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

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