RickB75 Posted September 30, 2014 Share Posted September 30, 2014 Guys, I need some help and guidance. I trying to figure out how to use WinHttpRequest and other functions from Trancexx's WinHttp UDF. I can connect to a page, login and get the first response txt after I login. I'm trying to figure out how to send the request to navaigate to the page I need. I'm sure I need to include data for the header info but this is where I'm getting lost. I don't know what info to include. I'm using Google Chrome's Dev Tool bar and I can see all the data in the Network section that's being sent. I just don't know the info that I need. I'm not asking for any of you guys to write the code, I'm just looking for some guidance. Do I need Cookie info ya think? Right now I'm lost. Unfortunately I can't give you guys login info on the website because it is a cooperate website. If you want me to post example code, I can. Link to comment Share on other sites More sharing options...
RickB75 Posted September 30, 2014 Author Share Posted September 30, 2014 Here's the weird part I'm running into. Once logged into the site, a pop up will flash on the my screen and then it gets hidden. Basically a redirect. I can read and get the source code for that pop up using WinHttp. I can't navigate to the home page of the site though. I keep getting an error. I've tried diff functions like _WinHttpSimpleSSLRequest and I get a page source back that says this page doesn't exist. I'm trying go to the Home page for testing purposes. Link to comment Share on other sites More sharing options...
RickB75 Posted September 30, 2014 Author Share Posted September 30, 2014 When I log in and I send the request, I keep getting a "The Page requested is not available" returned. Should I use be using a diff URL. If so, where would I find it?? If I don't put any page at all in, I get a "Hi There" response. Link to comment Share on other sites More sharing options...
MikahS Posted September 30, 2014 Share Posted September 30, 2014 I'm sure posting an example of what you are doing will bring help faster for you Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
RickB75 Posted September 30, 2014 Author Share Posted September 30, 2014 Ok... Here's a very similar script to what I'm using on our cooperate site. I'm using the Autoit forum as an example. I haven't tested this yet for this site so I'm not sure if it will actually login or not. Let's pretend we want to log in and go to the user settings page. expandcollapse popup#include "WinHttp.au3" Global $sDomain = "autoitscript.com" Global $sPage = "forum/index.php?app=core&module=usercp" ; Initialize and get session handle Global $hOpen = _WinHttpOpen() ; Get connection handle Global $hConnect = _WinHttpConnect($hOpen, $sDomain) _WinHttpSimpleFormFill($hConnect, "forum", "inline_login_form", "name:ips_username", "myUserName","name:ips_password","myPassword") ; Make a request Global $hRequest = _WinHttpOpenRequest($hConnect, "GET", $sPage) _WinHttpAddRequestHeaders($hRequest, "Content-Type: application/x-www-form-urlencoded") ; Send it. Specify additional data to send too. This is required by the Google API: _WinHttpSendRequest($hRequest) ; Wait for the response _WinHttpReceiveResponse($hRequest) ; See what's returned Global $sReturned If _WinHttpQueryDataAvailable($hRequest) Then ; if there is data Do $sReturned &= _WinHttpReadData($hRequest) Until @error EndIf ; Close handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; See what's returned ConsoleWrite($sReturned) ;MsgBox(0, "Returned", $sReturned) Link to comment Share on other sites More sharing options...
iamtheky Posted September 30, 2014 Share Posted September 30, 2014 Automating the login to this forum might not be the best example. While you are not technically bypassing the security measure, logins and captchas are generally off limits as they lead to spam potential, spatential. There used to be a big "Do Not Automate The Forums" but i cant seem to locate that now anywhere except in quotes from Valik, so maybe its ok now? ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
RickB75 Posted September 30, 2014 Author Share Posted September 30, 2014 (edited) Guys... I guess this was a bad example. I'm not concerned with the automation of logging in. My question is once I'm logged in to whatever website(gmail, hotmail, ect...), how do I correctly send a request for a page within the site. Thats what my question is. I know the rules about asking for help with auto login scripts and I'm not asking for that. I'm just trying to figure out how to send a proper request. I'm missing something in my main script and I don't know what it is. If the moderators feel that this is a auto login script then please lock the thread and I won't ask anymore and I'm sorry to have bothered you guys with this question and I don't mean or want to break any forum rules. Edited September 30, 2014 by RickB75 Link to comment Share on other sites More sharing options...
iamtheky Posted September 30, 2014 Share Posted September 30, 2014 (edited) The "guys" probably have no issue, I generally have viewpoints that are all my own. It is apparent what the goal is so dont sweat that, but certainly dont be surprised (nor offended) if scripts directed at the autoit site draw additional scrutiny and are discouraged. I use the google API for gmail, places, and maps. hotmail i have no idea. What "page" are you attempting to navigate to within gmail? To make automated requests in damn near all their stuff I have to use my API Key. Your request may also be better met through another means, I use JSON (the JSMN UDF) for all my fetches. Edited September 30, 2014 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now