wwHTTP::Get

Uses an HTTP GET operation to retrieve Web content from a URL. GET operations pass only the URL and no content body data.

DO wwHttp
LOCAL loHttp as wwHttp OF wwhttp.prg
loHttp = CREATEOBJECT("wwHttp")
lcHtml = loHttp.Get("https://microsoft.com")
? lcHtml

*** Prefer to recreate the object each time
loHttp = CREATEOBJECT("wwHttp")
lcJson = loHttp.Get("https://api.exchangeratesapi.io/latest")
? lcJson

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

o.Get(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.

Parameters

lcUrl
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

lcUserName
Optional - Username used for Basic Authentication

lcPassword
Optional - Password used for Basic Authentication

lcFileName
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, 2023 • Updated: 08/28/20
Comment or report problem with topic