Fuego.NetX : AdvancedWebServer

The AdvancedWebServer component is used to send HTTP requests to HTTP servers and capture the responses. It supports the following HTTP methods: GET, POST, PUT, HEAD and DELETE.

This component supports: persistent connections, HTTPS, proxies (SOCKS4 and SOCKS5), cookies, HTTP headers and HTTP authentication. Use the CookieManager component if you need to send HTTP "cookies" with your requests.

This component returns HTTP responses as instances of HttpResponse.

This component is commonly used in the following scenarios:
  • To integrate with other systems using custom protocols on top of HTTP (e.g. custom XML messages over HTTP and "REST" services).
  • To automate actions performed in a web browser. For example, for submitting a form on an existing web application.

Example: Get Oracle's website home page and save it to a file.

do 
  ws = AdvancedWebServer()
  connectTo(ws, protocol : "http", host : "oracle.com", port : 80)
                    
  response = getFrom(ws, file : "/")

  BinaryFile.writeFromBinaryTo(data : response.data,
                               name : "/tmp/oracle.html",
                             append : false)
on exit
  disconnectFrom ws
end
Related reference
Fuego.NetX : HttpResponse
Fuego.NetX : Cookie
Fuego.NetX : CookieManager