diff --git a/README.txt b/README.txt index 474074a..cd456fd 100644 --- a/README.txt +++ b/README.txt @@ -27,7 +27,8 @@ limits, chunk size, and max redirects to follow. Can handle data with content-encoding and transfer-encoding headers set. Correctly follows redirects. Option to forward the referrer when a redirect is found. Cookie extraction and parsing into key value pairs. Can multipart encode data so files -can easily be sent in a HTTP request. +can easily be sent in a HTTP request. Will emulate a range request if the server +does not support range requests. REQUIREMENTS @@ -53,6 +54,10 @@ Settings page is located at: * IP Address to send all self server requests to. If left blank it will use the same server as the request. If set to -1 it will use the host name instead of an IP address. This controls the output of httprl_build_url_self(). + * Enable background callbacks. If disabled all background_callback keys will + be turned into callback & httprl_queue_background_callback will return NULL + and not queue up the request. Note that background callbacks will + automatically be disabled if the site is in maintenance mode. API OVERVIEW @@ -71,6 +76,8 @@ httprl_queue_background_callback() - Queue a special HTTP request (used for threading) in httprl_send_request(). Other Functions: +httprl_is_background_callback_capable() + - See if httprl can issue a background callback. httprl_background_processing() - Output text, close connection, continue processing in the background. httprl_strlen() @@ -116,6 +123,21 @@ Request http://drupal.org/. ?> +Request http://drupal.org/robots.txt and save it to tmp folder. + + code == 200) { + file_put_contents('/tmp/robots.txt', $request['http://drupal.org/robots.txt']->data); + } + ?> + + Request this servers own front page & the node page. '', 242 => '', 243 => '', 244 => ''); foreach ($nodes as $nid => &$node) { @@ -462,6 +489,11 @@ Run a function in the background. Notice that there is no return or printed key in the callback options. 'system_get_files_database', @@ -515,6 +552,11 @@ Get 2 results from 2 different queries at the hook_boot bootstrap level in D6. unset($x, $y); + // Bail out here if background callbacks are disabled. + if (!httprl_is_background_callback_capable()) { + return FALSE; + } + // Run above 2 queries and get the result via a background callback. $args = array( // First query. @@ -572,6 +614,12 @@ Get 2 results from 2 different queries at the hook_boot bootstrap level in D7. echo $x . "
\n" . $y . "
\n"; unset($x, $y); + + // Bail out here if background callbacks are disabled. + if (!httprl_is_background_callback_capable()) { + return FALSE; + } + // Run above 2 queries and get the result via a background callback. $args = array( // First query. @@ -661,6 +709,11 @@ non blocking background request. system_clear_cache_submit(); + // Bail out here if background callbacks are disabled. + if (!httprl_is_background_callback_capable()) { + return FALSE; + } + // How to do it in a non blocking background request. $args = array( array(