This class is used to access data over the network using HTTP GETs. Methods are available to get the data, given the URL and to step through the data line by line or return the entire result in a buffer. The syntax of the URL may be one of the following:
In the first case, an HTTP GET is done to retrieve the data for the URL. If the URL starts with " file :", the contents of the local file is returned. If the URL does not start with " file :" or " http :", it may be a local command to execute. In this case, the command is executed and the output of the command is returned. This last case is only allowed if explicitly enabled with the allowUrlExec () method. This should only be done if you know that it is safe to execute the command.
The following example does an HTTP get on url and prints the result:
HTTP http; int nlines = 0; char* buf = http.get(url, nlines); printf("answer = (%d lines)\n%s\n", nlines, (buf ? buf : "ERROR"));
See the man page HTTP(3) for details on the various constructors and methods.
Please send questions or comments to abrighto@eso.org.
Copyright © 1998 ESO - European Southern Observatory