httpQuery() [v0.3.5]

Author: DerRaphael Last Modified: 20080828


This is a small function for handling POST and GET queries natively in AHK so external utilities to handle it are not needed any more. It can be used where no additional utilities, such as cURL or wget are wanted.
The latest version handles following features:

* ports in URL
* Username:Password@domain style URLs (see this answer to avoid common problems)
* SSL aka https
* HeaderInformations / Dumping / Storing
* DownloadSizes / CurrentSize (for download progressbars)
* Flags for InternetConnection handling (auto follow feature etc)
* Referrer for Queries
* Accepttypes for Queries
* Proxy handling
* timeout handling
* custom UserAgent

httpQuery(byref Result, lpszUrl, POSTDATA="", HEADERS="")

For the functions's parameters and return value, please see it's source code or the document.

Remarks

The library is not strictly stdlib conform, because it makes use of some global variables.

The documentation is copied part from author`s forum post about the library.

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/topic33506.html

License

The functions is an open source item under the zLib-Style license.
For details, please see http://en.wikipedia.org/wiki/Zlib_License

Example

; #Include httpQuery.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

; exmpl.searchAHKforum.httpQuery.ahk
; Searches the forum for a given Phrase: in this case httpQuery
#noenv
html     := ""
URL      := "http://www.autohotkey.com/forum/search.php?mode=results"
POSTData := "search_keywords=httpQuery&search_terms=all&search_forum=-1&"
          . "search_time=0&search_fields=all&show_results=topics&return_chars=500"
          . "&sort_by=0&sort_dir=DESC"

length := httpQuery(html,URL,POSTdata)
varSetCapacity(html,-1)

Gui,Add,Edit,w600 +Wrap r25,% html
Gui,Show
Return

GuiClose:
GuiEscape:
   ExitApp