Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Last active September 5, 2023 02:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JoeGlines/40438c955c8afbe1123bd0a355247b45 to your computer and use it in GitHub Desktop.
Save JoeGlines/40438c955c8afbe1123bd0a355247b45 to your computer and use it in GitHub Desktop.
Example WinHTTPRequest for API call
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY
; Right now you can get a coupon code here: https://the-Automator.com/Learn
;*******************************************************
#SingleInstance,Force
;********************WinHTTP request***********************************
HTTP:=ComObjCreate("WinHttp.WinHttpRequest.5.1") ;Create COM Object
HTTP.Open("GET","https://www.autohotkey.com/boards/memberlist.php?mode=viewprofile&u=114")
HTTP.SetRequestHeader("Cookie","_ga=GA1.2.948743824.158940030; __cfduid=d6e365bic6b23f55d1c04595b6935256e01591460854; _gid=GA1.2.1697507601.1591460855; phpbb3_ghjir_u=114; phpbb3_ghjir_k=dc1bc7e06bf11a1b; phpbb3_ghjir_sid=253b7ed833a562970bdbc8fe7357e4da")
HTTP.SetRequestHeader("User-Agent","Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko")
HTTP.Send()
DisplayHTML(HTTP.ResponseText,1400,1000)
return
DisplayHTML(HTML,w=300,h=400){
static wb
gui,margin,0,0
gui, Add, ActiveX, x0 y0 w%w% h%h% vWB, shell explorer
wb.Silent:=True
wb.Navigate("about:blank")
wb.document.write(HTML)
gui, Show, , HTML returned
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment