summaryrefslogtreecommitdiff
path: root/it_url.class
diff options
context:
space:
mode:
authorUrban Müller2014-04-15 14:26:21 +0200
committerUrban Müller2014-04-15 14:26:21 +0200
commitfef9b217cbdb76103112995d4b94e95468826562 (patch)
tree548f05c0c51ec9a5dd31ae0ee1696b6cc6c88dc0 /it_url.class
parent2d676a6767ad2bc64b2e18c77c76fef9e6748ba9 (diff)
downloaditools-fef9b217cbdb76103112995d4b94e95468826562.tar.gz
itools-fef9b217cbdb76103112995d4b94e95468826562.tar.bz2
itools-fef9b217cbdb76103112995d4b94e95468826562.zip
support setting of it::error params in it_url::get
Diffstat (limited to 'it_url.class')
-rw-r--r--it_url.class21
1 files changed, 11 insertions, 10 deletions
diff --git a/it_url.class b/it_url.class
index 3888b17..e961b4c 100644
--- a/it_url.class
+++ b/it_url.class
@@ -220,15 +220,16 @@ function is_reachable($timeout = 5)
* If the protocol is not http, only features of get_multi are supported.
*
* @param $p parameter array with the following keys
- * @param $p['url']: url to get, defaults to constructor URL
- * @param $p['headers']: optional array of HTTP headers to send
- * @param $p['timeout']: timeout per read in seconds, defaults to 5. fractions allowed. silent, see $p['safety']
- * @param $p['safety']: set to 1 to generate an it::error in case of timeout
- * @param $p['totaltimeout']: timeout for the whole function call
- * @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['retries']: Number of retries if download fails, default 1
+ * @param $p['url'] url to get, defaults to constructor URL
+ * @param $p['headers'] optional array of HTTP headers to send
+ * @param $p['safety'] set to 1 to generate an it::error in case of timeout
+ * @param $p['it_error'] extra arguments given to it_error if safety is on an an error occurs
+ * @param $p['timeout'] timeout per read in seconds, defaults to 5. fractions allowed. silent, see $p['safety']
+ * @param $p['totaltimeout'] timeout for the whole function call
+ * @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['retries']: Number of retries if download fails, default 1
* @return contents of resulting page, considering redirects, excluding headers, or false on error
*/
function get($p=null, $timeout=5)
@@ -375,7 +376,7 @@ function request($p=array())
$result = false;
if ($result === false && $p['safety'] == 1)
- it::error("problem (timeout?) getting $url->url " . $errstr);
+ it::error(array('title' => "problem (timeout?) getting $url->url " . $errstr) + (array)$p['it_error']);
if ($p['maxlength'] && (strlen($this->data) + $len > $p['maxlength']))
$result = false;