Jump to content
Sign in to follow this  
Gui

[WinHTTP] Opening POST Result into browser?

Recommended Posts

Gui

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

Share this post


Link to post
Share on other sites
Gui

ie.au3. its in the helpfile

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

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

Sigh.

Share this post


Link to post
Share on other sites
monoscout999

I did understand you. You didn't read the helpfile. facepalm yourself.

he is reffered to winhttp object. maybe i am wrong but IE.au3 it has nothing to do with "winhttp" object

Share this post


Link to post
Share on other sites
wakillon

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

Share this post


Link to post
Share on other sites
Gui

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.

Share this post


Link to post
Share on other sites
wakillon

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

Share this post


Link to post
Share on other sites
Gui

Meh. I always use Web Requests dude to their speed and reliability. Thanks for the suggestion. I'll try to figure something out. >;p

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  

×