As Kalphiter stated, HTTP Objects are just as useful for GET requests, and even simpler to use that TCP Objects:
function getWebPage(%host, %port, %file) // For example, if we wanted to get the page "example.com:80/file.ext", then we would use getWebPage("example.com", 80, "/file.ext")
{
new HTTPObject(MyHTTPObject).get(%host @ ":" @ %port, %file); // Creating the HTTPObject and sending a request to example.com:80/file.ext
}
// Now we need to process the response
// Unlike TCPObjects, HTTPObjects do not return any headers
function MyHTTPObject::onLine(%this, %line)
{
%page = %page NL %line; // For each new line we add the data onto a single variable
if(%line $= "END") // You can have a line on the page, such as 'END' that tells the client to do something, in this case, run a function with the gathered data
{
doStuffWith(%page);
%this.disconnect();
%this.delete();
}
}
Alternatively, you can use the HTTPObject::onDisconnect method to let the script know the data is complete.