Jump to content

Send POST string to webpage?


karliky
 Share

Recommended Posts

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

Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
Share on other sites

  • 8 years later...
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]

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