Jump to content

[WinHTTP] Opening POST Result into browser?


Gui
 Share

Recommended Posts

Essentially, since the session doesn't expire, would it be possible to open the exact result page from a POST into maybe IE or something, so that instead of reading the source, you see the exact page?

I don't mean like:

FileDelete('Result.html')
FileWrite('Result.html', $data)
ShellExecute('Result.html')

because with that, it's just the source in an HTML file.

Hope it's possible! Thanks!

The code would look like so:

$hw_open = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 GTB7.1")
    
$hw_connect = _WinHttpConnect($hw_open, "host.com")
$oPost = "submit=1"
$oEx = "/index.php"
$h_openRequest = _WinHttpOpenRequest($hw_connect, "POST", $oEx, "HTTP/1.1")
_WinHttpSendRequest($h_openRequest, 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' & @CRLF & 'Content-Type: application/x-www-form-urlencoded' & @CRLF, $oPost)
_WinHttpReceiveResponse($h_openRequest)

$data = ''
Do
      $data &= _WinHttpReadData($h_openRequest) ; $data is complete source code return..
Until @error

;NOW open return URL to the source above ^ somehow into IE or something.

GUI

Edited by Gui
Link to comment
Share on other sites

I'm guessing you didn't understand my question. :facepalm:

I said a "POST", referring to web requests..? "[WinHTTP]"

Sigh.

Try Get instead Post

$_Url = "http://www.AutoItScript.com"
$httpObj = ObjCreate ( "winhttp.winhttprequest.5.1" )
$httpObj.open ( "GET", $_Url )
$httpObj.send ( )
$_HtmlSource = $httpObj.Responsetext
ConsoleWrite ( "-->-- Source Code : " & StringAddCR ( $_HtmlSource ) & @Crlf )

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Try Get instead Post

$_Url = "http://www.AutoItScript.com"
$httpObj = ObjCreate ( "winhttp.winhttprequest.5.1" )
$httpObj.open ( "GET", $_Url )
$httpObj.send ( )
$_HtmlSource = $httpObj.Responsetext
ConsoleWrite ( "-->-- Source Code : " & StringAddCR ( $_HtmlSource ) & @Crlf )

I'm using WinHTTP functions, first off. And second, I don't just need to return source, I want to open the return URL into a browser for interaction. I guess no one understands ;S? I'll add some code to the OP.
Link to comment
Share on other sites

I'm using WinHTTP functions, first off. And second, I don't just need to return source, I want to open the return URL into a browser for interaction. I guess no one understands ;S? I'll add some code to the OP.

I don't find any WinHTTP function who can open a web browser.

i suggest IE :

$oIE = ObjCreate ( "InternetExplorer.Application" )
$oIE.Navigate ( $_Url )

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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