Jump to content
trancexx

WinHTTP functions

Recommended Posts

Hi!

I've been using these functions a while, but now i stucked.

I created a script for my web page, to get some stuff from it, but now I try to send some message to it.

My problem is when I send the POST message with the given data it sends in an other packet. My browser doesn't splits this data apart from the header, and it sends almost the same http code as my script. Is it possible not to split this data?

My script sends these:

Packet #1:

POST /index.php? HTTP/1.1
Referer: http://www.mypage.com
Accept:
Content-Type: multipart/form-data; boundary=FGOPPTuB
Content-Length: 167
Referer: http://www.mypage.com/index.php?act=post
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5
Host: www.mypage.com
Connection: Keep-Alive
Cookie: session_id=c43e25e5c25c12907d8f90aea6e05f16

Packet #2:

--FGOPPTuB
Content-Disposition: form-data; name="User"

Admin
--FGOPPTuB
Content-Disposition: form-data; name="Message"

Some message comes here
--FGOPPTuB--

My browser sends this (FF v3.5):

POST /index.php? HTTP/1.1
Host: www.mypage.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.mypage.com/index.php?act=post
Cookie: session_id=769f31985d8cf428643a62c9b802de51
Content-Type: multipart/form-data; boundary=---------------------------12052273501150
Content-Length: 266

-----------------------------12052273501150
Content-Disposition: form-data; name="User"

Admin
-----------------------------12052273501150
Content-Disposition: form-data; name="Message"

Some message comes here
-----------------------------12052273501150--

Part of my script:

Const $BOUNDARY = _RandomString()
$Data = '--' & $BOUNDARY & @CRLF & _
 'Content-Disposition: form-data; name="User"' & @CRLF & _
 '' & @CRLF & _
 'Admin' & @CRLF & _
 '--' & $BOUNDARY & @CRLF & _ & @CRLF & _
 'Content-Disposition: form-data; name="Message"' & @CRLF & _
 '' & @CRLF & _
 'Some message comes here' & @CRLF & _
 '--' & $BOUNDARY & '--' & @CRLF
$sHeaders = "Content-Type: multipart/form-data; boundary=" & _RandomString() & @CRLF
$sHeaders &= "Content-Length: " & StringLen($Data) & @CRLF
$sHeaders &= "Referer: http://www.mypage.com/index.php?act=post"
_WinHttpSendRequest($hRequest, $sHeaders, $Data, StringLen($Data))

I'm not sure if this is the problem, but i tried to replace the headers to the same as the browsers, but without any success. I appreciate any other advices!

That's interesting. Are you sure there isn't an issue with the server side? Like the size of chunks to receive is set to some low level.

Try this. It should produce the same header as your browser's:

#include "WinHTTP.au3"


Const $BOUNDARY = _RandomString()

$sDataToSend = '--' & $BOUNDARY & @CRLF & _
        'Content-Disposition: form-data; name="User"' & @CRLF & _
        '' & @CRLF & _
        'Admin' & @CRLF & _
        '--' & $BOUNDARY & @CRLF & @CRLF & _
        'Content-Disposition: form-data; name="Message"' & @CRLF & _
        '' & @CRLF & _
        'Some message comes here' & @CRLF & _
        '--' & $BOUNDARY & '--' & @CRLF


$sAddress = "whatever.com" ;<- yours here

$hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5")

$hConnect = _WinHttpConnect($hOpen, $sAddress)

$hRequest = _WinHttpOpenRequest($hConnect)

$hRequest = _WinHttpOpenRequest($hConnect, _
        "POST", _ ; verb
        "index.php?", _ ; target
        "HTTP/1.1", _ ; version
        "http://www.mypage.com/index.php?act=post", _ ; referer
        "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") ; accept

_WinHttpAddRequestHeaders($hRequest, "Content-Type: multipart/form-data; boundary=" & $BOUNDARY)
_WinHttpAddRequestHeaders($hRequest, "Accept-Language: en-us,en;q=0.5")
_WinHttpAddRequestHeaders($hRequest, "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7")
_WinHttpAddRequestHeaders($hRequest, "Keep-Alive: 300")

_WinHttpSendRequest($hRequest, _
        $WINHTTP_NO_ADDITIONAL_HEADERS, _ ; no additional headers (all added above)
        $sDataToSend) ; data


_WinHttpReceiveResponse($hRequest)


If _WinHttpQueryDataAvailable($hRequest) Then
    Global $sHeader = _WinHttpQueryHeaders($hRequest)
    ConsoleWrite($sHeader & @CRLF & @CRLF)
    Global $sChunk, $sData, $extended
    While 1
        $sChunk = _WinHttpReadData($hRequest, 1)
        If @error Then ExitLoop
        $sData &= $sChunk
    WEnd

    ConsoleWrite($sData & @CRLF)
    #cs
        Global $sFile = @DesktopDir & "\Izebize.htm"
        Global $hFile = FileOpen($sFile, 2)
        FileWrite($hFile, $sData)
        FileClose($hFile)
    #ce
Else
    MsgBox(48, "Error", "Site is experiencing problems.")
EndIf



Func _RandomString()

    Return "---------------------------12052273501150"

    Return "----=BoundaryLine_" & Random(100000000, 999999999, 1)

EndFunc   ;==>_RandomString

@nguyenbason, what you have?

Share this post


Link to post
Share on other sites

Hi Trancexx,

With your help above, i can login now with following code:

#include "WinHTTP.au3"


$sUsername = "xxx"
$sPassword = "yyy"

$sAddress = "space.livevn.com"

$hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.0.3; .NET CLR 2.0.50727; ffco7) Gecko/2008092417 Firefox/3.0.3")

$hConnect = _WinHttpConnect($hOpen, $sAddress)

;Login
$hRequest = _WinHttpOpenRequest($hConnect, "POST", "/do.php?ac=71ee30ae117cddace55bd01714904227&&ref", "HTTP/1.1", "http://space.livevn.com/index.php", "*/*")

_WinHttpSendRequest($hRequest, _
        "Content-Type: application/x-www-form-urlencoded"& @CRLF, _; <- cookie here?
        "username=" & $sUsername & "&password=" & $sPassword & "&loginsubmit=&loginsubmit=loginnnnnnnnnnn&refer=network.html&formhash=c51a94db")

_WinHttpReceiveResponse($hRequest)


If _WinHttpQueryDataAvailable($hRequest) Then
    Global $sHeader = _WinHttpQueryHeaders($hRequest)
    If StringInStr($sHeader,'Set-Cookie: uchome_loginuser=' & $sUsername) Then
        MsgBox(0,"","Login success")
    Else
        MsgBox(0,"","Login failed")
    EndIf
Else
    MsgBox(48, "Error", "Site is experiencing problems.")
EndIf

And now i want to post new post to blog. But i don't know how to get post url like post url login that you gave. The form code i posted on above post.

$subject = "testttt"
$msg = "tttest"
$hRequest = _WinHttpOpenRequest($hConnect, "POST", "/cp.php?ac=blog&blogid=", "HTTP/1.1", "http://space.livevn.com/cp.php?ac=blog", "*/*")

_WinHttpSendRequest($hRequest, _
       "Content-Type: application/x-www-form-urlencoded"& @CRLF, _
        ;i dont know how to post here with that form)

_WinHttpReceiveResponse($hRequest)

If _WinHttpQueryDataAvailable($hRequest) Then
    Global $sHeader = _WinHttpQueryHeaders($hRequest)
    ConsoleWrite($sHeader & @CRLF & @CRLF)
    Global $sChunk, $sData, $extended
    While 1
        $sChunk = _WinHttpReadData($hRequest, 1)
        If @error Then ExitLoop
        $sData &= $sChunk
    WEnd

    ConsoleWrite($sData & @CRLF)

Else
    MsgBox(48, "Error", "Site is experiencing problems.")
EndIf

Thanks Trancexx,

Share this post


Link to post
Share on other sites

castoff?

No, think Outkast (except going back words, kind of a play on words)

Advantages or disadvantages of this or that are yet to be determined.

This is not reinventing the wheel, but offering another option. Something like this:

Beep(400, 200)
DllCall("msvcrt.dll", "int:cdecl", "_beep", "int", 500, "int", 200)
DllCall("kernel32.dll","int", "Beep","int",600,"int",200)
DllCall("pncrt.dll", "int:cdecl", "_beep", "int", 700, "int", 200)

I stand corrected, keep up the good work. :)

Share this post


Link to post
Share on other sites

Hi Trancexx,

With your help above, i can login now with following code:

#include "WinHTTP.au3"


$sUsername = "xxx"
$sPassword = "yyy"

$sAddress = "space.livevn.com"

$hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.0.3; .NET CLR 2.0.50727; ffco7) Gecko/2008092417 Firefox/3.0.3")

$hConnect = _WinHttpConnect($hOpen, $sAddress)

;Login
$hRequest = _WinHttpOpenRequest($hConnect, "POST", "/do.php?ac=71ee30ae117cddace55bd01714904227&&ref", "HTTP/1.1", "http://space.livevn.com/index.php", "*/*")

_WinHttpSendRequest($hRequest, _
        "Content-Type: application/x-www-form-urlencoded"& @CRLF, _; <- cookie here?
        "username=" & $sUsername & "&password=" & $sPassword & "&loginsubmit=&loginsubmit=loginnnnnnnnnnn&refer=network.html&formhash=c51a94db")

_WinHttpReceiveResponse($hRequest)


If _WinHttpQueryDataAvailable($hRequest) Then
    Global $sHeader = _WinHttpQueryHeaders($hRequest)
    If StringInStr($sHeader,'Set-Cookie: uchome_loginuser=' & $sUsername) Then
        MsgBox(0,"","Login success")
    Else
        MsgBox(0,"","Login failed")
    EndIf
Else
    MsgBox(48, "Error", "Site is experiencing problems.")
EndIf

And now i want to post new post to blog. But i don't know how to get post url like post url login that you gave. The form code i posted on above post.

$subject = "testttt"
$msg = "tttest"
$hRequest = _WinHttpOpenRequest($hConnect, "POST", "/cp.php?ac=blog&blogid=", "HTTP/1.1", "http://space.livevn.com/cp.php?ac=blog", "*/*")

_WinHttpSendRequest($hRequest, _
       "Content-Type: application/x-www-form-urlencoded"& @CRLF, _
        ;i dont know how to post here with that form)

_WinHttpReceiveResponse($hRequest)

If _WinHttpQueryDataAvailable($hRequest) Then
    Global $sHeader = _WinHttpQueryHeaders($hRequest)
    ConsoleWrite($sHeader & @CRLF & @CRLF)
    Global $sChunk, $sData, $extended
    While 1
        $sChunk = _WinHttpReadData($hRequest, 1)
        If @error Then ExitLoop
        $sData &= $sChunk
    WEnd

    ConsoleWrite($sData & @CRLF)

Else
    MsgBox(48, "Error", "Site is experiencing problems.")
EndIf

Thanks Trancexx,

To tell you the truth I have no idea.

But do try something like this. And try hard lol (I'm curious):

#include "WinHTTP.au3"

; your data
$sUsername = "UserName"
$sPassword = "Password"

; Address
$sAddress = "space.livevn.com"

; Initialize and get session handle
$hOpen = _WinHttpOpen()

; Get connection handle
$hConnect = _WinHttpConnect($hOpen, $sAddress)

;Request
$hRequest = _WinHttpOpenRequest($hConnect, _
        "POST", _ ; verb
        "/do.php?ac=71ee30ae117cddace55bd01714904227&&ref", _  ; target
        "HTTP/1.1", _ ; version
        "http://space.livevn.com/index.php", _  ; referer
        "*/*") ; accept

; Send it
_WinHttpSendRequest($hRequest, _
        "Content-Type: application/x-www-form-urlencoded" & @CRLF, _
        "username=" & $sUsername & "&password=" & $sPassword & "&loginsubmit=&loginsubmit=loginnnnnnnnnnn&refer=network.html&formhash=c51a94db")

; Wait for the response
_WinHttpReceiveResponse($hRequest)

; See what's returned
If _WinHttpQueryDataAvailable($hRequest) Then
    Global $sHeader = _WinHttpQueryHeaders($hRequest)
    ConsoleWrite($sHeader & @CRLF)

    If StringInStr($sHeader, 'Set-Cookie: uchome_loginuser=' & $sUsername) Then
        MsgBox(0, "", "Login success")
    Else
        MsgBox(0, "", "Login failed")
    EndIf
Else
    MsgBox(48, "Error 1", "Site is experiencing problems.")
EndIf



ConsoleWrite("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" & @CRLF)



; Close that handle
_WinHttpCloseHandle($hRequest)

; Boundary line
$BOUNDARY = _RandomString()

; So, what's this? You need to comprehend this fully in order to use it. Maybe I'm not doing this right.
$sSubject = "Title of  this"
$sMessage = "Body of this"
$sTag = "testing"
$iFriend = ""
$sPassword = ""
$sSelectgroup = ""
$sTarget_names = ""
$sBlogSubmit = "True"
$sFormHash = "597b16ca"

$sDataToSend = '--' & $BOUNDARY & @CRLF & _
        'Content-Disposition: form-data; name="classid"' & @CRLF & _
        @CRLF & _
        '0' & @CRLF & _
        '--' & $BOUNDARY & @CRLF & _
        'Content-Disposition: form-data; name="subject"' & @CRLF & _
        @CRLF & _
        $sSubject & @CRLF & _ ; or title if you like
        '--' & $BOUNDARY & @CRLF & _
        'Content-Disposition: form-data; name="message"' & @CRLF & _
        @CRLF & _
        $sMessage & @CRLF & _ ; or body if you like
        '--' & $BOUNDARY & @CRLF & _
        'Content-Disposition: form-data; name="tag"' & @CRLF & _
        @CRLF & _
        $sTag & @CRLF & _ ; tag can be important
        '--' & $BOUNDARY & @CRLF & _
        'Content-Disposition: form-data; name="friend"' & @CRLF & _
        @CRLF & _
        $iFriend & @CRLF & _ ;
        '--' & $BOUNDARY & @CRLF & _
        'Content-Disposition: form-data; name="password"' & @CRLF & _
        @CRLF & _
        $sPassword & @CRLF & _ ;
        '--' & $BOUNDARY & @CRLF & _
        'Content-Disposition: form-data; name="selectgroup"' & @CRLF & _
        @CRLF & _
        $sSelectgroup & @CRLF & _ ;
        '--' & $BOUNDARY & @CRLF & _
        'Content-Disposition: form-data; name="target_names"' & @CRLF & _
        @CRLF & _
        $sTarget_names & @CRLF & _ ;
        '--' & $BOUNDARY & @CRLF & _
        'Content-Disposition: form-data; name="blogsubmit"' & @CRLF & _
        @CRLF & _
        $sBlogSubmit & @CRLF & _ ;
        '--' & $BOUNDARY & @CRLF & _
        'Content-Disposition: form-data; name="formhash"' & @CRLF & _
        @CRLF & _
        $sFormHash & @CRLF & _ ;
        '--' & $BOUNDARY & '--'

; New request
$hRequest = _WinHttpOpenRequest($hConnect, _
        "POST", _ ; verb
        "cp.php?ac=blog&blogid=", _  ; target
        "HTTP/1.1", _ ; version
        "http://space.livevn.com/cp.php?ac=blog", _ ; referer
        "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5") ; accept

; Add some headers
_WinHttpAddRequestHeaders($hRequest, "Content-Type: multipart/form-data; boundary=" & $BOUNDARY)
_WinHttpAddRequestHeaders($hRequest, "Accept-Language: en-us,en;q=0.5")
_WinHttpAddRequestHeaders($hRequest, "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7")
_WinHttpAddRequestHeaders($hRequest, "Cache-Control: max-age=0")
_WinHttpAddRequestHeaders($hRequest, "Origin: http://space.livevn.com")

; Send new request
_WinHttpSendRequest($hRequest, _
        $WINHTTP_NO_ADDITIONAL_HEADERS, _ ; no additional headers (all added above)
        $sDataToSend) ; data

; Wait for the response
_WinHttpReceiveResponse($hRequest)

; See what's returned
If _WinHttpQueryDataAvailable($hRequest) Then

    $sHeader = _WinHttpQueryHeaders($hRequest)
    ConsoleWrite($sHeader & @CRLF)

    Global $sChunk, $sData
    While 1
        $sChunk = _WinHttpReadData($hRequest, 1)
        If @error Then ExitLoop
        $sData &= $sChunk
    WEnd

    ConsoleWrite($sData & @CRLF)

    ;#cs
    ; Write it somewhere to see what's that
    Global $sFile = @DesktopDir & "\ReturnedPage.htm"
    Global $hFile = FileOpen($sFile, 2)
    FileWrite($hFile, $sData)
    FileClose($hFile)
    ;#ce

Else
    MsgBox(48, "Error 2", "Site is experiencing problems.")
EndIf

; Close open handles
_WinHttpCloseHandle($hRequest)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

; The end
Exit ; this is redundant of course





; Used function
Func _RandomString()

    Return "----=BoundaryLine_" & Random(100000000, 999999999, 1)

EndFunc   ;==>_RandomString

@Kastout, okey doke

Share this post


Link to post
Share on other sites

Another question Trancexx, I use _WinHttpReadData to read source of a website in Russian but it return ???? for all Russian characters. Anyway to read correct texts in Russian?

Thanks.

What site?

Try:

#include "WinHTTP.au3"


Global $hOpen = _WinHttpOpen()

If @error Then
    MsgBox(48, "Error", "Error initializing the usage of WinHTTP functions.")
    Exit
EndIf

_WinHttpSetOption($hOpen, $WINHTTP_OPTION_USER_AGENT, "Who the fuc*k is Alice???")

Global $hConnect = _WinHttpConnect($hOpen, "www.pravda.ru") ; <- yours here
If @error Then
    MsgBox(48, "Error", "Error specifying the initial target server of an HTTP request.")
    _WinHttpCloseHandle($hOpen)
    Exit
EndIf

Global $hRequest = _WinHttpOpenRequest($hConnect)
If @error Then
    MsgBox(48, "Error", "Error creating an HTTP request handle.")
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)
    Exit
EndIf

; Just to check agent
ConsoleWrite("! Custom agent: " & _WinHttpQueryOption($hOpen, $WINHTTP_OPTION_USER_AGENT) & @CRLF & @CRLF)

_WinHttpSendRequest($hRequest)
If @error Then
    MsgBox(48, "Error", "Error sending specified request.")
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)
    Exit
EndIf

_WinHttpReceiveResponse($hRequest)

If _WinHttpQueryDataAvailable($hRequest) Then
    Global $sHeader = _WinHttpQueryHeaders($hRequest)
    ConsoleWrite($sHeader & @CRLF & @CRLF)
    Global $sChunk, $sData
    While 1
        $sChunk = _WinHttpReadData($hRequest, 1) ; <- mode 1
        If @error Then ExitLoop
        $sData &= $sChunk
    WEnd

    ConsoleWrite($sData & @CRLF)

    Global $sFile = @DesktopDir & "\Pravda.ru.htm"
    Global $hFile = FileOpen($sFile, 130)
    FileWrite($hFile, $sData)
    FileClose($hFile)

Else
    MsgBox(48, "Error", "Site is experiencing problems.")
EndIf

_WinHttpCloseHandle($hRequest)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

Share this post


Link to post
Share on other sites

What site?

Try:

#include "WinHTTP.au3"


Global $hOpen = _WinHttpOpen()

If @error Then
    MsgBox(48, "Error", "Error initializing the usage of WinHTTP functions.")
    Exit
EndIf

_WinHttpSetOption($hOpen, $WINHTTP_OPTION_USER_AGENT, "Who the fuc*k is Alice???")

Global $hConnect = _WinHttpConnect($hOpen, "www.pravda.ru") ; <- yours here
If @error Then
    MsgBox(48, "Error", "Error specifying the initial target server of an HTTP request.")
    _WinHttpCloseHandle($hOpen)
    Exit
EndIf

Global $hRequest = _WinHttpOpenRequest($hConnect)
If @error Then
    MsgBox(48, "Error", "Error creating an HTTP request handle.")
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)
    Exit
EndIf

; Just to check agent
ConsoleWrite("! Custom agent: " & _WinHttpQueryOption($hOpen, $WINHTTP_OPTION_USER_AGENT) & @CRLF & @CRLF)

_WinHttpSendRequest($hRequest)
If @error Then
    MsgBox(48, "Error", "Error sending specified request.")
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)
    Exit
EndIf

_WinHttpReceiveResponse($hRequest)

If _WinHttpQueryDataAvailable($hRequest) Then
    Global $sHeader = _WinHttpQueryHeaders($hRequest)
    ConsoleWrite($sHeader & @CRLF & @CRLF)
    Global $sChunk, $sData
    While 1
        $sChunk = _WinHttpReadData($hRequest, 1) ; <- mode 1
        If @error Then ExitLoop
        $sData &= $sChunk
    WEnd

    ConsoleWrite($sData & @CRLF)

    Global $sFile = @DesktopDir & "\Pravda.ru.htm"
    Global $hFile = FileOpen($sFile, 130)
    FileWrite($hFile, $sData)
    FileClose($hFile)

Else
    MsgBox(48, "Error", "Site is experiencing problems.")
EndIf

_WinHttpCloseHandle($hRequest)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

It does not work :) If use normal read data with mode 0, i cannot read in console but can read if open saved file (pravda.ru.htm). If you above code, can not read even open this file.

Back to previous case about posting to blog. I can post to that page if i set cookie (even don't need to login)

$sDataToSend3 = '-----------------------------8723974127529' & @CRLF & _
'Content-Disposition: form-data; name="classid"' & @CRLF & _
'' & @CRLF & _
'0' & @CRLF & _
'-----------------------------8723974127529' & @CRLF & _
'Content-Disposition: form-data; name="subject"' & @CRLF & _
'' & @CRLF & _
'subject 5' & @CRLF & _
'-----------------------------8723974127529' & @CRLF & _
'Content-Disposition: form-data; name="message"' & @CRLF & _
'' & @CRLF & _
'message 5<br>' & @CRLF & _
'-----------------------------8723974127529' & @CRLF & _
'Content-Disposition: form-data; name="tag"' & @CRLF & _
'' & @CRLF & _
'subject' & @CRLF & _
'-----------------------------8723974127529' & @CRLF & _
'Content-Disposition: form-data; name="friend"' & @CRLF & _
'' & @CRLF & _
'0' & @CRLF & _
'-----------------------------8723974127529' & @CRLF & _
'Content-Disposition: form-data; name="password"' & @CRLF & _
'' & @CRLF & _
'' & @CRLF & _
'-----------------------------8723974127529' & @CRLF & _
'Content-Disposition: form-data; name="noreply"' & @CRLF & _
'' & @CRLF & _
'1' & @CRLF & _
'-----------------------------8723974127529' & @CRLF & _
'Content-Disposition: form-data; name="selectgroup"' & @CRLF & _
'' & @CRLF & _
'' & @CRLF & _
'-----------------------------8723974127529' & @CRLF & _
'Content-Disposition: form-data; name="target_names"' & @CRLF & _
'' & @CRLF & _
'' & @CRLF & _
'-----------------------------8723974127529' & @CRLF & _
'Content-Disposition: form-data; name="blogsubmit"' & @CRLF & _
'' & @CRLF & _
'true' & @CRLF & _
'-----------------------------8723974127529' & @CRLF & _
'Content-Disposition: form-data; name="formhash"' & @CRLF & _
'' & @CRLF & _
'60e948de' & @CRLF & _
'-----------------------------8723974127529--'
; New request
$hRequest = _WinHttpOpenRequest($hConnect, _
        "POST", _ ; verb
        "cp.php?ac=blog&blogid=", _  ; target
        "HTTP/1.1", _ ; version
        "http://space.livevn.com/cp.php?ac=blog", _ ; referer
        "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") ; accept

; Add some headers
_WinHttpAddRequestHeaders($hRequest, "Accept-Language: en-us,en;q=0.5")
_WinHttpAddRequestHeaders($hRequest, "Accept-Encoding: gzip,deflate")
_WinHttpAddRequestHeaders($hRequest, "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7")
_WinHttpAddRequestHeaders($hRequest, "Referer: http://space.livevn.com/cp.php?ac=blog")
_WinHttpAddRequestHeaders($hRequest, 'Cookie: __utma=201876307.4095121941824170000.1241451209.1247243241.1247329535.14; __utmz=201876307.1241451209.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); uchome_loginuser=sonnb; uchome_sendmail=1; __utmb=201876307.6.10.1247329535; __utmc=201876307; uchome_auth=a481eVW%2Few6skcBlizkAMMStPUCMAoJUUoWBW%2BkUaKXOTMTVzLgxty2MJl3HIpnI%2BXoW2J8XekcYtjW%2FMak5zEEejQ; uchome_synfriend=1')
_WinHttpAddRequestHeaders($hRequest, 'Content-Type: multipart/form-data; boundary=---------------------------8723974127529')

; Send new request
_WinHttpSendRequest($hRequest, _
        $WINHTTP_NO_ADDITIONAL_HEADERS, _ ; no additional headers (all added above)
        $sDataToSend3) ; data

; Wait for the response
_WinHttpReceiveResponse($hRequest)

; See what's returned
If _WinHttpQueryDataAvailable($hRequest) Then

    $sHeader = _WinHttpQueryHeaders($hRequest)
    ConsoleWrite($sHeader & @CRLF)

    Global $sChunk, $sData
    While 1
        $sChunk = _WinHttpReadData($hRequest, 1)
        If @error Then ExitLoop
        $sData &= $sChunk
    WEnd

    ConsoleWrite($sData & @CRLF)

    ;#cs
    ; Write it somewhere to see what's that
    Global $sFile = @DesktopDir & "\ReturnedPage.htm"
    Global $hFile = FileOpen($sFile, 2)
    FileWrite($hFile, $sData)
    FileClose($hFile)
    ;#ce

Else
    MsgBox(48, "Error 2", "Site is experiencing problems.")
EndIf


; Close open handles
_WinHttpCloseHandle($hRequest)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

; The end
Exit

And the user posted these posts always are sonnb. I tried login to another account and copy cookie but seem doesnot work. How can i get these like cookie for each login username and set to header for correctly posting?

Thanks :)

Edited by nguyenbason

Share this post


Link to post
Share on other sites

There are rules that need to be followed if you want to do that properly.

Cookies are given to you by server and server makes rules.

You probably (likely) need to logout before you re-logon as another user.

Also, there is one option that you can set to disable cookies. Maybe then you can set them manually. Anyway it's:

_WinHttpSetOption($hHandle, $WINHTTP_OPTION_DISABLE_FEATURE, $WINHTTP_DISABLE_COOKIES)

As for pravda.ru, read binary and then you can interpret binary data as it suits you.

Share this post


Link to post
Share on other sites

There are rules that need to be followed if you want to do that properly.

Cookies are given to you by server and server makes rules.

You probably (likely) need to logout before you re-logon as another user.

Also, there is one option that you can set to disable cookies. Maybe then you can set them manually. Anyway it's:

_WinHttpSetOption($hHandle, $WINHTTP_OPTION_DISABLE_FEATURE, $WINHTTP_DISABLE_COOKIES)

Sorry if I did not say clearly. I mean how can i get that cookie for each logon user? The above cookie I took from header addon in FF. Query header after user login using Winhttp does not return it.

Share this post


Link to post
Share on other sites

Sorry if I did not say clearly. I mean how can i get that cookie for each logon user? The above cookie I took from header addon in FF. Query header after user login using Winhttp does not return it.

If it doesn't return then you didn't login (or was already logged in).

Share this post


Link to post
Share on other sites

Hi trancexx,

I'm trying to use winHttp for imdb login. But, once it uses SSL conection, I can't see the packages which my browser sends to iMDB server.

Here's the website: https://secure.imdb.com/register-imdb/login

I tried to write a script which would be capable to login (but it's not working):

#include "WinHTTP.au3"
$hw_open = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)")
$hw_connect = _WinHttpConnect($hw_open, "secure.imdb.com")
$h_openRequest = _WinHttpOpenRequest($hw_connect, "POST", "register-imdb/login","HTTP/1.1","<a href='[url="https://secure.imdb.com/register-imdb/login"]https://secure.imdb.com/register-imdb/login[/url]' class='bbc_url' title='External link' rel='external'>[url="https://secure.imdb.com/register-imdb/login"]https://secure.imdb.com/register-imdb/login[/url]</a>","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
_WinHttpAddRequestHeaders($h_openRequest,"Accept-Language: en-us,en;q=0.5")
_WinHttpAddRequestHeaders($h_openRequest,"Accept-Encoding: gzip,deflate")
_WinHttpAddRequestHeaders($h_openRequest,"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7")
_WinHttpAddRequestHeaders($h_openRequest,"Keep-Alive: 300")
_WinHttpAddRequestHeaders($h_openRequest,"Connection: keep-alive")
$post = "login=myemail&password=mypass"
_WinHttpSendRequest($h_openRequest,"Content-Type: application/x-www-form-urlencoded" & @CRLF,$post)
_WinHttpReceiveResponse($h_openRequest)
If _WinHttpQueryDataAvailable($h_openRequest) Then
    $header = _WinHttpQueryHeaders($h_openRequest)
    ClipPut($header)
EndIf
_WinHttpCloseHandle($h_openRequest)
_WinHttpCloseHandle($hw_connect)
_WinHttpCloseHandle($hw_open)

Here's the post tamperdata:

Posted Image

Expected response (Cookies altered for obvious reasons):

Status=Found - 302
Date=Tue, 11 Aug 2009 22:42:16 GMT
Server=Server
Cache-Control=private
Expires=Thu, 01 Jan 1970 22:00:00 GMT
Location=<a href='[url="https://secure.imdb.com/cookie?c=sid:9f12ec3a,id:7aafb2f6&u=https%3A%2F%2Fsecure.imdb.com%2Fregister-imdb%2Flogin%3F"]https://secure.imdb.com/cookie?c=sid:9f12ec3a,id:7aafb2f6&u=https%3A%2F%2Fsecure.imdb.com%2Fregister-imdb%2Flogin%3F[/url]' class='bbc_url' title='External link' rel='external'>[url="https://secure.imdb.com/cookie?c=sid:9f1...cure.imdb.com%2Fregister-imdb%2Flogin%3F"]https://secure.imdb.com/cookie?c=sid:9f1...cure.imdb.com%2Fregister-imdb%2Flogin%3F[/url]</a>
Cneonction=close
Content-Type=text/plain
Set-Cookie=cs=Me2Gn1pCQurLiaaaaaaaaaaaSQbWOzqgkW26lIYZaaaaaaaaaaaaaaaaaaaaayfpnwkW2KB9EtmqCRWyxAaaaaaaaaaaRbbqgsW2aaaaaaaaHYqg==;expires=Wed, 12 Aug 2009 07:00:00 GMT;path=/;domain=.imdb.com
sid=muJVtMM9+MxRTDEWwxRIHgBpfK8z6mo5c+rZSuDJ2Rp2fgaaaaaaaaaaaaaaaaaagaVoZ0DkqCX;expires=Thu, 30 Dec 2037 00:00:00 GMT;path=/;secure=true;domain=.imdb.com
id=NgcDMDIEGWaaaaaaaaO0ZsBwPyPUXgsT6yoHEtaaaaaaaaaaaaaaaaaaaaaaaaaap2Ro/I5lES07rKmxVhaaaaaawBS4SQ/IesoUSvqSz8h6URbRJkqUHKbQzUorlw/I9RHaaaaaaaaaaa1BM6ypWTcVJf0aGS1ZFjlhaaaaaaaaaaaaaaaaaiboKg==;expires=Thu, 30 Dec 2037 00:00:00 GMT;path=/;domain=.imdb.com
Vary=Accept-Encoding,User-Agent
Content-Encoding=gzip
P3P=policyref="<a href='[url="http://i.imdb.com/images/p3p.xml"]http://i.imdb.com/images/p3p.xml[/url]' class='bbc_url' title='External link' rel='external'>[url="http://i.imdb.com/images/p3p.xml"]http://i.imdb.com/images/p3p.xml[/url]</a>",CP="IMDB "
Content-Length=3184
nnCoection=close
Edited by TheGeneral

Share this post


Link to post
Share on other sites

Hi trancexx,

I'm trying to use winHttp for imdb login. But, once it uses SSL conection, I can't see the packages which my browser sends to iMDB server.

Here's the website: https://secure.imdb.com/register-imdb/login

I tried to write a script which would be capable to login (but it's not working):

#include "WinHTTP.au3"
$hw_open = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)")
$hw_connect = _WinHttpConnect($hw_open, "secure.imdb.com")
$h_openRequest = _WinHttpOpenRequest($hw_connect, "POST", "register-imdb/login","HTTP/1.1","<a href='[url="https://secure.imdb.com/register-imdb/login"]https://secure.imdb.com/register-imdb/login[/url]' class='bbc_url' title='External link' rel='external'>[url="https://secure.imdb.com/register-imdb/login"]https://secure.imdb.com/register-imdb/login[/url]</a>","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
_WinHttpAddRequestHeaders($h_openRequest,"Accept-Language: en-us,en;q=0.5")
_WinHttpAddRequestHeaders($h_openRequest,"Accept-Encoding: gzip,deflate")
_WinHttpAddRequestHeaders($h_openRequest,"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7")
_WinHttpAddRequestHeaders($h_openRequest,"Keep-Alive: 300")
_WinHttpAddRequestHeaders($h_openRequest,"Connection: keep-alive")
$post = "login=myemail&password=mypass"
_WinHttpSendRequest($h_openRequest,"Content-Type: application/x-www-form-urlencoded" & @CRLF,$post)
_WinHttpReceiveResponse($h_openRequest)
If _WinHttpQueryDataAvailable($h_openRequest) Then
    $header = _WinHttpQueryHeaders($h_openRequest)
    ClipPut($header)
EndIf
_WinHttpCloseHandle($h_openRequest)
_WinHttpCloseHandle($hw_connect)
_WinHttpCloseHandle($hw_open)

Here's the post tamperdata:

Posted Image

Expected response (Cookies altered for obvious reasons):

Status=Found - 302
Date=Tue, 11 Aug 2009 22:42:16 GMT
Server=Server
Cache-Control=private
Expires=Thu, 01 Jan 1970 22:00:00 GMT
Location=<a href='[url="https://secure.imdb.com/cookie?c=sid:9f12ec3a,id:7aafb2f6&u=https%3A%2F%2Fsecure.imdb.com%2Fregister-imdb%2Flogin%3F"]https://secure.imdb.com/cookie?c=sid:9f12ec3a,id:7aafb2f6&u=https%3A%2F%2Fsecure.imdb.com%2Fregister-imdb%2Flogin%3F[/url]' class='bbc_url' title='External link' rel='external'>[url="https://secure.imdb.com/cookie?c=sid:9f1...cure.imdb.com%2Fregister-imdb%2Flogin%3F"]https://secure.imdb.com/cookie?c=sid:9f1...cure.imdb.com%2Fregister-imdb%2Flogin%3F[/url]</a>
Cneonction=close
Content-Type=text/plain
Set-Cookie=cs=Me2Gn1pCQurLiaaaaaaaaaaaSQbWOzqgkW26lIYZaaaaaaaaaaaaaaaaaaaaayfpnwkW2KB9EtmqCRWyxAaaaaaaaaaaRbbqgsW2aaaaaaaaHYqg==;expires=Wed, 12 Aug 2009 07:00:00 GMT;path=/;domain=.imdb.com
sid=muJVtMM9+MxRTDEWwxRIHgBpfK8z6mo5c+rZSuDJ2Rp2fgaaaaaaaaaaaaaaaaaagaVoZ0DkqCX;expires=Thu, 30 Dec 2037 00:00:00 GMT;path=/;secure=true;domain=.imdb.com
id=NgcDMDIEGWaaaaaaaaO0ZsBwPyPUXgsT6yoHEtaaaaaaaaaaaaaaaaaaaaaaaaaap2Ro/I5lES07rKmxVhaaaaaawBS4SQ/IesoUSvqSz8h6URbRJkqUHKbQzUorlw/I9RHaaaaaaaaaaa1BM6ypWTcVJf0aGS1ZFjlhaaaaaaaaaaaaaaaaaiboKg==;expires=Thu, 30 Dec 2037 00:00:00 GMT;path=/;domain=.imdb.com
Vary=Accept-Encoding,User-Agent
Content-Encoding=gzip
P3P=policyref="<a href='[url="http://i.imdb.com/images/p3p.xml"]http://i.imdb.com/images/p3p.xml[/url]' class='bbc_url' title='External link' rel='external'>[url="http://i.imdb.com/images/p3p.xml"]http://i.imdb.com/images/p3p.xml[/url]</a>",CP="IMDB "
Content-Length=3184
nnCoection=close

If you want https then you have to define that with _WinHttpConnect(). Third parameter should be $INTERNET_DEFAULT_HTTPS_PORT, otherwise you are connecting on port 80.

Another thing is that you need to add $WINHTTP_FLAG_SECURE to _WinHttpOpenRequest(). That would be the last parameter for that function.

Share this post


Link to post
Share on other sites

If you want https then you have to define that with _WinHttpConnect(). Third parameter should be $INTERNET_DEFAULT_HTTPS_PORT, otherwise you are connecting on port 80.

Another thing is that you need to add $WINHTTP_FLAG_SECURE to _WinHttpOpenRequest(). That would be the last parameter for that function.

Thank you very much, it worked perfectly >_<

Edited by TheGeneral

Share this post


Link to post
Share on other sites

Hello this is my first time using WinHTTP.au3. I'm trying to make a login script for http://www.hyves.nl/ but it doesn't work. I already set the parameters for HTTPS.

Headers:

https://secure.hyves.org/?module=authentication&action=login&r=3d317a73

POST /?module=authentication&action=login&r=3d317a73 HTTP/1.1
Host: secure.hyves.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: chatInitialPresence=online
Content-Type: application/x-www-form-urlencoded
Content-Length: 191
PHPSESSID=34a7826c2fe4bb3474ea1f96f884b934&auth_currentUrl=http%3A%2F%2Fwww.hyves.nl%2F%3F&auth_username=MYUSER&auth_password=MYPASS&auth_autologin=on&login_initialPresence=offline&btnLogin=


HTTP/1.x 303 See Other
Server: nginx
Date: Sun, 16 Aug 2009 15:59:47 GMT
Content-Type: text/html; charset=ISO-8859-1
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=10
Set-Cookie: UBU=hyves.nl; path=/; domain=secure.hyves.org; secure
Set-Cookie: auth_id=9954557; expires=Mon, 16-Aug-2010 21:59:46 GMT; path=/; domain=secure.hyves.org; secure; httponly
Set-Cookie: auth_a=97c8a3bdaf474f50129f6887cd752e42; expires=Mon, 16-Aug-2010 21:59:46 GMT; path=/; domain=secure.hyves.org; secure; httponly
Set-Cookie: SC=q1bKULIyNDHSUUoH0jpKiUpWSkkm5onmKeYpSrUA; path=/; domain=secure.hyves.org; secure; httponly
Expires: 0
Cache-Control: private
Pragma: no-cache
Location: http://www.hyves.nl/?module=Authentication&action=clientLogin&auth_id=9954557&auth_a=0664bb31f1b22c6eecc60ed6db4383c2&auth_t=1250438376&persist=1&auth_currentUrl=http%3A%2F%2Fwww.hyves.nl%2F%3F&login_initialPresence=offline&pageid=2JN628QMMGAO0OGOW&PHPSESSID=34a7826c2fe4bb3474ea1f96f884b934

Script:

#include "WinHTTP.au3"


$myuser = "username"
$mypass = "password"


$hw_open = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1")
$hw_connect = _WinHttpConnect($hw_open, "secure.hyves.org", $INTERNET_DEFAULT_HTTPS_PORT)
$h_openRequest = _WinHttpOpenRequest($hw_connect, "POST", "/?module=authentication&action=login&r=2a6a89fb","HTTP/1.1","https://secure.hyves.org","*/*",$WINHTTP_FLAG_SECURE)

$post = "auth_currentUrl=http%3A%2F%2Fwww.hyves.nl%2F%3F&auth_username=sndw&auth_password=12341234x&login_initialPresence=offline&btnLogin="
_WinHttpSendRequest($h_openRequest,"Content-Type: application/x-www-form-urlencoded" & @CRLF,$post)
_WinHttpReceiveResponse($h_openRequest)



If _WinHttpQueryDataAvailable($h_openRequest) Then
    Global $header = _WinHttpQueryHeaders($h_openRequest)
    
    If StringInStr($header,'Set-Cookie: auth_id=9954557;') Then
        MsgBox(0,"","Login success")
    Else
        MsgBox(0,"","Login failed")
    EndIf
Else
    MsgBox(48, "Error", "Site is experiencing problems.")
EndIf


_WinHttpCloseHandle($h_openRequest)
_WinHttpCloseHandle($hw_connect)
_WinHttpCloseHandle($hw_open)

Hope someone can help me out >_<

Thanks

Share this post


Link to post
Share on other sites

Hello this is my first time using WinHTTP.au3. I'm trying to make a login script for http://www.hyves.nl/ but it doesn't work. I already set the parameters for HTTPS.

Headers:

https://secure.hyves.org/?module=authentication&action=login&r=3d317a73

POST /?module=authentication&action=login&r=3d317a73 HTTP/1.1
Host: secure.hyves.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: chatInitialPresence=online
Content-Type: application/x-www-form-urlencoded
Content-Length: 191
PHPSESSID=34a7826c2fe4bb3474ea1f96f884b934&auth_currentUrl=http%3A%2F%2Fwww.hyves.nl%2F%3F&auth_username=MYUSER&auth_password=MYPASS&auth_autologin=on&login_initialPresence=offline&btnLogin=


HTTP/1.x 303 See Other
Server: nginx
Date: Sun, 16 Aug 2009 15:59:47 GMT
Content-Type: text/html; charset=ISO-8859-1
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=10
Set-Cookie: UBU=hyves.nl; path=/; domain=secure.hyves.org; secure
Set-Cookie: auth_id=9954557; expires=Mon, 16-Aug-2010 21:59:46 GMT; path=/; domain=secure.hyves.org; secure; httponly
Set-Cookie: auth_a=97c8a3bdaf474f50129f6887cd752e42; expires=Mon, 16-Aug-2010 21:59:46 GMT; path=/; domain=secure.hyves.org; secure; httponly
Set-Cookie: SC=q1bKULIyNDHSUUoH0jpKiUpWSkkm5onmKeYpSrUA; path=/; domain=secure.hyves.org; secure; httponly
Expires: 0
Cache-Control: private
Pragma: no-cache
Location: http://www.hyves.nl/?module=Authentication&action=clientLogin&auth_id=9954557&auth_a=0664bb31f1b22c6eecc60ed6db4383c2&auth_t=1250438376&persist=1&auth_currentUrl=http%3A%2F%2Fwww.hyves.nl%2F%3F&login_initialPresence=offline&pageid=2JN628QMMGAO0OGOW&PHPSESSID=34a7826c2fe4bb3474ea1f96f884b934

Script:

#include "WinHTTP.au3"


$myuser = "username"
$mypass = "password"


$hw_open = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1")
$hw_connect = _WinHttpConnect($hw_open, "secure.hyves.org", $INTERNET_DEFAULT_HTTPS_PORT)
$h_openRequest = _WinHttpOpenRequest($hw_connect, "POST", "/?module=authentication&action=login&r=2a6a89fb","HTTP/1.1","https://secure.hyves.org","*/*",$WINHTTP_FLAG_SECURE)

$post = "auth_currentUrl=http%3A%2F%2Fwww.hyves.nl%2F%3F&auth_username=sndw&auth_password=12341234x&login_initialPresence=offline&btnLogin="
_WinHttpSendRequest($h_openRequest,"Content-Type: application/x-www-form-urlencoded" & @CRLF,$post)
_WinHttpReceiveResponse($h_openRequest)



If _WinHttpQueryDataAvailable($h_openRequest) Then
    Global $header = _WinHttpQueryHeaders($h_openRequest)
    
    If StringInStr($header,'Set-Cookie: auth_id=9954557;') Then
        MsgBox(0,"","Login success")
    Else
        MsgBox(0,"","Login failed")
    EndIf
Else
    MsgBox(48, "Error", "Site is experiencing problems.")
EndIf


_WinHttpCloseHandle($h_openRequest)
_WinHttpCloseHandle($hw_connect)
_WinHttpCloseHandle($hw_open)

Hope someone can help me out >_<

Thanks

I can't even open that page. So no help from me.

Share this post


Link to post
Share on other sites

Hi,

I want to connect to $hw_connect = _WinHttpConnect($hw_open, "s29.wurzelimperium.de" ) but it always connects to the Lower Level Domain: wurzelimperium.de, why doesn't it connect to s29.wurzelimperium.de?

Edit: i read on msdn that i must use _WinHttpQueryOption with Flag $WINHTTP_OPTION_URL but this doesn't work _WinHttpQueryOption($hw_open,$WINHTTP_OPTION_URL) ?

Edited by Greek

Share this post


Link to post
Share on other sites

Use _WinHttpSetOption(). The query functions just return information to you.

EDIT

WINHTTP_OPTION_URL

Retrieves a string value that contains the full URL of a downloaded resource. If the original URL contained any extra data, such as search strings or anchors, or if the call was redirected, the URL returned differs from the original. The application should pass in a buffer, sized in bytes, that is big enough to hold the returned URL in wide char.

That doesn't sound like what you want. Edited by wraithdu

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

×
×
  • Create New...