Jump to content

WinHTTP: Let a Website know that I visited a page


Floppy
 Share

Recommended Posts

Hello, I'm creating a script to login to a Website and visit a page.

To make it as fast as possible I made the login part with WinHTTP.au3 - _WinHttpSimpleFormFill function. It's very fast!

Once logged in, I need to surf a page of that site but I don't need to see it. In other words, the Website should know that I opened that page. I have 2 options:

1) Surfing it with _IENavigate in a hidden window.

2) Surfing it using WinHTTP

The problem with Option 1 is that if I don't "connect" _IENavigate to _WinHttpConnect, I am not logged in (I think this is because of the cookies).

Question: Is there a way to "connect" _IENavigate to _WinHttpConnect?

The problem with Option 2 is that I don't know what to do! Is there a way to let the Website know that I visited a page?

I hope you understand everything!!

Thank you for help and bye!

Edited by FSoft
Link to comment
Share on other sites

When working with WinHttp every connection made within the same session as login was made upon, will share cookies unless specified differently. You will be browsing logged-in.

IE or any other app can't use your sessions (hence cookies) because it has its own sessions. It would be like after logging with Chrome browser to expect that when opened the site with Firefox you would be logged on.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Ok, thank you. Suppose I need to visit www.google.com/search/items/45715 ... I wrote this script

#include "WinHttp.au3"
$address = "google.com"
$open_http = _WinHttpOpen()
$connector = _WinHttpConnect($open_http, $address)
$request = _WinHttpOpenRequest($connector)
_WinHttpSendRequest($request)
_WinHttpReceiveResponse($request)
Global $chunk, $data
If _WinHttpQueryDataAvailable($request) Then
    While 1
        $chunk = _WinHttpReadData($request)
        If @error Then ExitLoop
        $data &= $chunk
    WEnd
ConsoleWrite($data)
Else
    MsgBox(48, "Error", "Site is experiencing problems.")
EndIf
_WinHttpCloseHandle($request)
_WinHttpCloseHandle($connector)
_WinHttpCloseHandle($open_http)

Where should I specify "search/items/45715" to notify the Website?

Link to comment
Share on other sites

This way?

#include "WinHttp.au3"
$address = "google.com"
$open_http = _WinHttpOpen()
$connector = _WinHttpConnect($open_http, $address)
$request = _WinHttpOpenRequest($connector)
_WinHttpSendRequest($request, Default, "search/items/45715")
_WinHttpReceiveResponse($request)
Global $chunk, $data
If _WinHttpQueryDataAvailable($request) Then
    While 1
        $chunk = _WinHttpReadData($request)
        If @error Then ExitLoop
        $data &= $chunk
    WEnd
ConsoleWrite($data)
Else
    MsgBox(48, "Error", "Site is experiencing problems.")
EndIf
_WinHttpCloseHandle($request)
_WinHttpCloseHandle($connector)
_WinHttpCloseHandle($open_http)
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...