A GDownloader can download files and data over an internet connection. More...
#include "gdownloader.h"
Signals | |
| void | downloaded() |
| This Qt signal fires when the data is done downloading. More... | |
Public Member Functions | |
| GDownloader() | |
| Creates a new downloader. More... | |
| ~GDownloader() | |
| Frees memory allocated internally by the downloader. More... | |
| string | downloadAsString(string url) |
| Downloads the text contents of the given URL, returning them as a string. More... | |
| void | downloadToFile(string url, string file) |
| Downloads the text contents of the given URL, saving it to the given output file. More... | |
| string | getErrorMessage() const |
| Returns the last HTTP error message that occurred. More... | |
| string | getHeader(string name) const |
| Returns the value of the given HTTP header for this URL request. More... | |
| int | getHttpStatusCode() const |
| Returns the most recent HTTP status code, which may be a successful code (e.g. More... | |
| string | getUserAgent() const |
| Returns the value of the HTTP "User-Agent" header for this URL request, or an empty string if the user agent has not been set. More... | |
| bool | hasError() const |
| Returns true if the HTTP connection failed and had an error. More... | |
| void | httpGet(string url) |
| Performs an HTTP GET request to the given URL. More... | |
| void | httpPost(string url) |
| Performs an HTTP POST request to the given URL, submitting any headers and query parameters previously specified. More... | |
| void | setHeader(string name, string value) |
| void | setUserAgent(string userAgent) |
A GDownloader can download files and data over an internet connection.
It can save the data to a file or return the data as a string.
| GDownloader | ( | ) |
Creates a new downloader.
|
virtual |
Frees memory allocated internally by the downloader.
| string downloadAsString | ( | string | url | ) |
Downloads the text contents of the given URL, returning them as a string.
This method blocks until the data is finished downloading.
|
signal |
This Qt signal fires when the data is done downloading.
| void downloadToFile | ( | string | url, |
| string | file | ||
| ) |
Downloads the text contents of the given URL, saving it to the given output file.
This method blocks until the data is finished downloading.
| string getErrorMessage | ( | ) | const |
Returns the last HTTP error message that occurred.
If no HTTP errors have occurred, returns "".
| string getHeader | ( | string | name | ) | const |
Returns the value of the given HTTP header for this URL request.
If the given header is not defined, returns an empty string.
| int getHttpStatusCode | ( | ) | const |
Returns the most recent HTTP status code, which may be a successful code (e.g.
200) or an error (e.g 404). If there is no HTTP status code to return, returns 0.
| string getUserAgent | ( | ) | const |
Returns the value of the HTTP "User-Agent" header for this URL request, or an empty string if the user agent has not been set.
| bool hasError | ( | ) | const |
Returns true if the HTTP connection failed and had an error.
You can see what the error was by calling getErrorMessage.
| void httpGet | ( | string | url | ) |
Performs an HTTP GET request to the given URL.
along with any headers previously specified.
| void httpPost | ( | string | url | ) |
Performs an HTTP POST request to the given URL, submitting any headers and query parameters previously specified.
| void setHeader | ( | string | name, |
| string | value | ||
| ) |
| void setUserAgent | ( | string | userAgent | ) |
1.8.14