Uses an HTTP PUT operation to post content to the server and to retrieve Web content from a URL.

DO wwHttp
LOCAL loHttp as wwHttp OF wwhttp.prg
loHttp = CREATEOBJECT("wwHttp")

*** post HTML form variables

lcHTML = loHttp.Put("https://yoursite.com/some/endpoint")

lcJson = loApp.GetRequestJson()  && some method that gets data

*** Prefer to recreate wwHttp
loHttp = CREATEOBJECT("wwHttp")

*** post raw data buffer (JSON in this case)

lcHTML = loHttp.Put("https://yoursite.com/some/json/endpoint")

PUT is similar to POST but semantically used for updates, while POST is semantically used for additions in REST APIs

Please also see wwHttp::HttpGet and Access Http Content over the Web

o.Put(lcUrl, lcUserName, lcPassword, lcOutputFile)

Return Value

String - HTTP result, which most likely will be HTML, but can be whatever data the link returns. This includes XML and binary data like Word documents or even data files. On error this string will be blank and the nError and cErrorMsg properties will be set.


The full URL you want to retrieve. This URL must include the protocol (HTTP or HTTPS for example) and the Domain Name or IP Address. Example: http://www.west-wind.com/wwipstuff.asp

Optional - Username used for Basic Authentication

Optional - Password used for Basic Authentication

An optional path into which to download the content into. If this parameter is used the return value from this method will always return blank and only the file is created on success. To check for errors, check the nError/cErrorMsg and the cResultCode properties.

See also:

Class wwHTTP | wwHttp::HttpGet

© West Wind Technologies, 2020 • Updated: 02/06/19
Comment or report problem with topic