Sign in to follow this  
Followers 0
Floppy

WinHTTP: Let a Website know that I visited a page

6 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



It will know you visited a page if you sent a HTTP request to that page. As far as the server knows, a simple HTTP request and navigating to a page with a web browser is the same, so unless it uses some strange method of detecting whether you've accessed a page then they should be the same.

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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)

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  
Followers 0