diff options
author | Urban Müller | 2024-04-30 14:10:30 +0200 |
---|---|---|
committer | Urban Müller | 2024-04-30 14:10:30 +0200 |
commit | c4ecbedc0b092eaa9a1296ee9cd1551cae8f7cdd (patch) | |
tree | 1806f229e54f10d1cdb8c4c759ee2fcf6aa3b8cf /it_url.class | |
parent | d6a73f40ff8c291207274979e3a575da2ae0c0eb (diff) | |
download | itools-c4ecbedc0b092eaa9a1296ee9cd1551cae8f7cdd.tar.gz itools-c4ecbedc0b092eaa9a1296ee9cd1551cae8f7cdd.tar.bz2 itools-c4ecbedc0b092eaa9a1296ee9cd1551cae8f7cdd.zip |
reorganize documentation for it_url::get
Diffstat (limited to 'it_url.class')
-rw-r--r-- | it_url.class | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/it_url.class b/it_url.class index abaf9e6..9af36e3 100644 --- a/it_url.class +++ b/it_url.class @@ -89,27 +89,33 @@ static function _postprocess($data, $p) /** * Get simple URL with timeout and one retry. Can be called statically. Times out, calls it::error for all errs * + * Request initiation * @param $p parameter array with the following keys * @param $p['url'] url to get, defaults to constructor URL - * @param $p['assoc'] Return [ 'data' => string, 'status' => int, 'cookies' => array, 'headers' => array, 'errstr' => string ] instead of just data * @param $p['headers'] optional assoc array of HTTP headers to send, e.g. ['Host' => "foo"] - * @param $p['safety'] DEPRECATED. 0 = ignore errors, 1 = errors, 2 = fatals - * @param $p['it_error'] extra arguments for it_error or false to ignore errors - * @param $p['timeout'] inactivity timeout seconds, default 5. fractions ok. silent by default - * @param $p['totaltimeout'] timeout for the whole attempt but see $['retry'] - * @param $p['maxlength'] maximum length of response - * @param $p['filemtime'] Add HTTP header to only fetch when newer than this, otherwise return true instead of data * @param $p['data'] POST data array with key-value pairs * @param $p['files'] [fieldname => filename] of files to upload - * @param $p['writefunction'] function to be called whenever data is received (for server-sent-events etc.) - * @param $p['fetchsleep'] Number of seconds to wait after fetch, fractions ok - * @param $p['followlocation']Follow redirects [true] - * @param $p['retries'] Number of retries if download fails, default 1 - * @param $p['retrysleep'] Number of seconds to wait before retry (additional to fetchsleep), fractions ok + * @param $p['maxlength'] maximum length of response + * @param $p['filemtime'] Add HTTP header to only fetch when newer than this, otherwise return true instead of data * @param $p['accept_encoding'] Contents of the "Accept-Encoding: " header. Enables decoding of the response. Set to null to disable, "" (default) for all supported encodings. - * @param $p['postprocess'] function called with content and $p which has it_error. returns content or null (which triggers retry) * @param $p['protocols'] Array of protocols to accept, defaults to ['http', 'https'], @see curl_opts for other values + * + * Problem handling + * @param $p['retries'] Number of retries if download fails, default 1 + * @param $p['timeout'] inactivity timeout seconds, default 5. fractions ok. silent by default + * @param $p['totaltimeout'] timeout for the whole attempt but see $['retry'] + * @param $p['retrysleep'] Number of seconds to wait before retry (additional to fetchsleep), fractions ok + * @param $p['safety'] DEPRECATED. 0 = ignore errors, 1 = errors, 2 = fatals + * @param $p['it_error'] extra arguments for it_error or false to ignore errors + * @param $p['fetchsleep'] Number of seconds to wait after fetch, fractions ok * @param $p['empty_on_fail'] Return empty page if http status code is >= 400 + + * Result processing + * @param $p['assoc'] Return [ 'data' => string, 'status' => int, 'cookies' => array, 'headers' => array, 'errstr' => string ] instead of just data + * @param $p['writefunction'] function to be called whenever data is received (for server-sent-events etc.) + * @param $p['postprocess'] function called with content and $p which has it_error. returns content or null (which triggers retry) + * @param $p['followlocation']Follow redirects [true] + * @return Content of resulting page (considering redirects, excluding headers or false on error) or array (empty on error) if 'assoc' => true */ static function get($p = []) |