summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2016-03-30 13:24:53 +0300
committerAndrew Dolgov <[email protected]>2016-03-30 13:25:32 +0300
commite3bc4591afbc8e93a3dbdc751d6a4e70256b81d9 (patch)
tree7289deffb31760dcb0d3b6e55895773fdf3e1c2e /include
parent00b6b66827c5ce0c103399f2742581fa90d50a97 (diff)
add a hash-based fetch_file_contents2()
Diffstat (limited to 'include')
-rwxr-xr-xinclude/functions.php29
1 files changed, 28 insertions, 1 deletions
diff --git a/include/functions.php b/include/functions.php
index d43943966..6a230a153 100755
--- a/include/functions.php
+++ b/include/functions.php
@@ -333,7 +333,25 @@
}
}
- function fetch_file_contents($url, $type = false, $login = false, $pass = false, $post_query = false, $timeout = false, $timestamp = 0, $useragent = false) {
+ // TODO: deprecated, remove
+ function fetch_file_contents($url, $type = false, $login = false, $pass = false, $post_query = false,
+ $timeout = false, $timestamp = 0, $useragent = false) {
+
+ $options = array(
+ "url" => $url,
+ "type" => $type,
+ "login" => $login,
+ "pass" => $pass,
+ "post_query" => $post_query,
+ "timeout" => $timeout,
+ "timestamp" => $timestamp,
+ "useragent" => $useragent
+ );
+
+ return fetch_file_contents2($options);
+ }
+
+ function fetch_file_contents2($options) {
global $fetch_last_error;
global $fetch_last_error_code;
@@ -341,6 +359,15 @@
global $fetch_last_content_type;
global $fetch_curl_used;
+ $url = $options["url"];
+ $type = isset($options["type"]) ? $options["type"] : false;
+ $login = isset($options["login"]) ? $options["login"] : false;
+ $pass = isset($options["pass"]) ? $options["pass"] : false;
+ $post_query = isset($options["post_query"]) ? $options["post_query"] : false;
+ $timeout = isset($options["timeout"]) ? $options["timeout"] : false;
+ $timestamp = isset($options["timestamp"]) ? $options["timestamp"] : 0;
+ $useragent = isset($options["useragent"]) ? $options["useragent"] : false;
+
$url = ltrim($url, ' ');
$url = str_replace(' ', '%20', $url);