psynegy Posted January 30, 2009 Posted January 30, 2009 I was working on a script to authenticate with gmail's atom feed and give the results of it's findings, but I'm having trouble working out how to authenticate with the server, I found the documentation on winhttp's authentication setup, but I'm lost with it.MSDN Documentation:http://msdn.microsoft.com/en-us/library/aa383144(VS.85).aspxMy code so far:$oHTTP = ObjCreate("winhttp.winhttprequest.5.1") MsgBox(0, "", (_HTTPRequest($oHTTP, "GET", "https://mail.google.com/mail/feed/atom") & @CRLF)) Func _HTTPRequest($oHTTP, $oMethod, $oURL, $oData = "") $oHTTP.Open($oMethod, $oURL, False) If $oMethod = "POST" Then $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.Send($oData) Return $oHTTP.ResponseText EndFuncWould really appreciate any help or pointers! Thanks
psynegy Posted January 30, 2009 Author Posted January 30, 2009 Scratch that, I've done it! Found a site that had used the WinHTTP object with auth in a different language and was able to work it out from that!
spudw2k Posted January 31, 2009 Posted January 31, 2009 Scratch that, I've done it!Found a site that had used the WinHTTP object with auth in a different language and was able to work it out from that! Care to share? Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
psynegy Posted March 18, 2010 Author Posted March 18, 2010 Care to share? Sorry for replying so late, but I didn't see the reply until now when I got a PM asking for the code. This is a function I pulled from one of my programs which checks a G-Mail email count. Simples. Func CheckGmail() $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", "https://mail.google.com/mail/feed/atom", False) $oHTTP.SetCredentials($gmail_username, $gmail_password, 0) $oHTTP.Send() $response = $oHTTP.ResponseText If StringInStr($response, "<fullcount>", false) Then $_COUNT = _StringBetween($response, "<fullcount>", "</fullcount>") $_COUNT = Int($_COUNT[0]) $s = "s" If $_COUNT = 0 Then $_COUNT = "no" ElseIf $_COUNT = 1 Then $s = "" EndIf $_RETURN = "You have " & $_COUNT & " new email" & $s Else $_RETURN = "Gmail Error" $_COUNT = False EndIf $_INFO[$gmail_count_i] = $_RETURN EndFunc
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