ralphomarion Posted March 15, 2022 Share Posted March 15, 2022 Hi, I'm trying to send a referrer and a cookie using WinHttp, but none of them work, ideas? Thanks. #include "Winhttp.au3" Global $hw_open = _WinHttpOpen("") 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: my-cookie=123456") _WinHttpAddRequestHeaders($h_openRequest, "Referrer: www.referrertest.com") _WinHttpSendRequest($h_openRequest) _WinHttpReceiveResponse($h_openRequest) $Response = _WinHttpQueryHeaders($h_openRequest) ConsoleWrite(@CRLF & "Header response:" & @CRLF & $Response & @CRLF) Header response: HTTP/1.1 200 OK Cache-Control: max-age=206, s-maxage=10 Connection: keep-alive Connection: Transfer-Encoding Date: Tue, 15 Mar 2022 08:12:39 GMT Transfer-Encoding: chunked Content-Type: text/html Expires: Tue, 15 Mar 2022 08:16:05 GMT Last-Modified: Tue, 15 Mar 2022 01:39:47 GMT Server: Apache X-Frame-Options: SAMEORIGIN X-Content-Type-Options: nosniff Referrer-Policy: no-referrer-when-downgrade X-UA-Compatible: IE=9; IE=8; IE=7; IE=EDGE X-Akamai-Transformed: 9 - 0 pmb=mRUM,2 Server-Timing: cdn-cache; desc=HIT Server-Timing: edge; dur=1 Strict-Transport-Security: max-age=86400 +>10:12:40 AutoIt3.exe ended.rc:0 +>10:12:40 AutoIt3Wrapper Finished. >Exit code: 0 Time: 2.096 Link to comment Share on other sites More sharing options...
Developers Jos Posted March 15, 2022 Developers Share Posted March 15, 2022 @beginner10 / @ralphomarion, I guess you still missed parts of our forum rules. This account is banned and stick to your original account! Final warning, next time you will be permanently banned. 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. Link to comment Share on other sites More sharing options...
Recommended Posts