Jump to content

Recommended Posts

Posted (edited)

Hello,

Below I used _WinHttpAddRequestHeaders to send a cookie on that page, but when I display the header using 

Header = _WinHttpQueryHeaders($h_openRequest)
ConsoleWrite(@CRLF & "HEADERS1:" & @CRLF & $Header & @CRLF & @CRLF)

 

.... , the cookie I set does not appear there.

 

I have been trying to solve this problem for a few weeks, but I am not successful at all, I have tried in various ways but without success. I'm still a beginner.
If anyone can help me, I would be grateful.

Thank you in advance.

#include "Winhttp.au3"

Global $hw_open = _WinHttpOpen("User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36")
If @error Then
    MsgBox(48, "Error", "Error initializing the usage of WinHTTP functions.")
    Exit
EndIf

Global $hw_connect = _WinHttpConnect($hw_open, "www.site.com")
If @error Then
    MsgBox(48, "Error", "Error specifying the initial target server of an HTTP request.")
    _WinHttpCloseHandle($hw_open)
    Exit
EndIf

$h_openRequest = _WinHttpOpenRequest($hw_connect, "POST")
If @error Then
    MsgBox(48, "Error", "Error creating an HTTP request handle.")
    _WinHttpCloseHandle($hw_connect)
    _WinHttpCloseHandle($hw_open)
    Exit
EndIf
_WinHttpAddRequestHeaders($h_openRequest, "Cookie: test=testcookie")

_WinHttpSendRequest($h_openRequest)


_WinHttpReceiveResponse($h_openRequest)
$Header = _WinHttpQueryHeaders($h_openRequest)
ConsoleWrite(@CRLF & "HEADERS1:" & @CRLF & $Header & @CRLF & @CRLF)

Exit

 

Edited by beginner10
Posted (edited)

@Jos

It is a general question, this problem is for any other site. and also the previous topic I reported.

Sorry for the previous post, it was accidental. My intentions are good.

Edited by beginner10
  • Developers
Posted (edited)

Honestly don't care. You asked it and there can't be just an accidental mistake to such a site. 

You also didn't answer my last question, but guess I know the answer as you would have known we discussed don't allow rephrased questions of locked threads 

So read it now.

*Click*

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Jos locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...