Provides functions for ease of use in most common HTTP operations: downloading to file/memory, POSTing forms, handling cookies and tracking progress.
Code: Select all
; Simple example
#Include Libcurl.ahk
; Don't forget to put dlls there!
Curl.Initialize(A_ScriptDir . "\libs")
; Curl.Deinitialize will be called automatically on exit.
myCurl := new Curl()
myCurl.SetUrl("http://example.com")
myCurl.WriteToFile("example_1_httpget.htm")
headBuffer := myCurl.HeaderToMem()
myCurl.Perform()
MsgBox % "Perform result:`n`n"
. myCurl.lastCode " : " myCurl.lastCodeText ; Should be '0 : No error'
MsgBox % "Headers:`n`n"
. headBuffer.GetAsText("UTF-8")
MsgBox % "Info:`n"
. "`n" . myCurl.GetInfo(Curl.Info.EFFECTIVE_URL)
. "`n" . myCurl.GetInfo(Curl.Info.RESPONSE_CODE)
. "`n" . myCurl.GetInfo(Curl.Info.TOTAL_TIME_T) / 1000000
• libcurl
• openssl (libcrypto + libssl)
You can download them yourself (links can be found inside LibCurl.ahk file), or take a 7z-archive i prepared here: https://yadi.sk/d/jG67uSxLOHaJOQ
Archive includes both 32/64-bit libcurl and certificate bundle (from curl.se) and openssl libraries from François Piette, all digitally signed and tested.
UPDATED 2021-01-06:
Completely rewritten from scratch, fixed storing data in memory, fixed urlencoding/urldecoding, added human-readable error codes (via curl_easy_strerror), added extended curl_version_info, why do you read this, it's not that interesting, you'll probably won't need this anyway, more details in Opt/Info enum tables, some extra functions, handles now cleanup automatically, better callback mechanics and some other things i want to forget.