Jump to content

Problem on login using WinHTTP winhttprequest. 5.1

Recommended Posts

Hello everyone.
I have a script that is responsible for logging in by doing a post on a Web page to download some files daily.


I used the following code, but something changed on the website that I can not log more.
$sPD = 'user=nelson***&pass=***'
$LinkBase = 'https://clientes.locucionar.com'

; Creating the object

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", $LinkBase & "/op/login.php", False)
$oHTTP.SetRequestHeader("Content-Type", "application/form-data")
$oReceived = $oHTTP.ResponseText

Also tried witch:

#include <winhttp.au3>
$hSession = _winHttpOpen('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecjo/20100101 Firefoz/25.0')

 $sHost= 'https://clientes.locucionar.com'
 $sHoas = _WinHttpConnect($hSession, $sHost)

  $sPost = 'user=nelso***&pass=***'

 $sPaket = _WinHttpSimpleSSLRequest($sHoas, 'Post', 'https://clientes.locucionar.com/op/login.php', 'https://clientes.locucionar.com', $sPost)

When logging in correctly I redirected to https://www.clientes.locucionar.com/admin.php

Now as you can not log it takes me to the site:


Which in English says I have no permissions to access the system.


The page always had HTTPS and before I logged in without doing anything extra.
I also tried adding cookies, and headers but I do not achieve anything.
$oHTTP.SetRequestHeader("Cookie", "PHPSESSID=pvpdn5vmthqkcvm6gp1683ucg0; TawkConnectionTime=0; __tawkuuid=e::clientes.locucionar.com::hfmN+K9YsUhfJtK5EhQ5GcsCAu6Slz3SmU1bqdbRyovFp7mEpOyZMuKczUxnB8Xd::2; Tawk_5710fd1d56e4984e3360e2e0=vs28.tawk.to::0")
$oHTTP.SetRequestHeader("Upgrade-Insecure-Requests", 1)
$oHTTP.SetRequestHeader("Content-Type", "application/form-data")
$oHTTP.SetRequestHeader("Origin", "http://clientes.locucionar.com")
$oHTTP.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
$oHTTP.SetRequestHeader("Accept-Encoding", "gzip, deflate, br")
$oHTTP.SetRequestHeader("Accept-Language", "es-US,es-419;q=0.8,es;q=0.6")
$oHTTP.SetRequestHeader("Content-Length", 34)
$oHTTP.SetRequestHeader("Cache-Control", "no-cache")
$oHTTP.SetRequestHeader("Connnection", "keep-alive")
$oHTTP.SetRequestHeader("Pragma", "no-cache")
$oHTTP.SetRequestHeader("Host", "clientes.locucionar.com")
$oHTTP.SetRequestHeader("Referer", "http://clientes.locucionar.com/index.php")


I can log in any HTML form that redirects to op/login.php But from AutoIt, it's making me impossible.

In case someone does a test. In case of incorrect user and password. OP/URlogin.php must be redirected to:



Any ideas?  


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