summaryrefslogtreecommitdiff
path: root/inc/HTTPClient.php
diff options
context:
space:
mode:
authorAndreas Gohr <gohr@cosmocode.de>2010-08-02 15:54:41 +0200
committerAndreas Gohr <gohr@cosmocode.de>2010-08-02 15:54:41 +0200
commit7e7f15ca0aadcdadcb930ab025be1c7311365078 (patch)
treea0c454b2f790f87138c5f5ca21af65c0ff43927d /inc/HTTPClient.php
parentca0095d06dade6118afd8205b99001892b7f1296 (diff)
downloadrpg-7e7f15ca0aadcdadcb930ab025be1c7311365078.tar.gz
rpg-7e7f15ca0aadcdadcb930ab025be1c7311365078.tar.bz2
Convenience function in HTTPClient
The new dget() method works accepts URL parameters as associative array (like the post() method).
Diffstat (limited to 'inc/HTTPClient.php')
-rw-r--r--inc/HTTPClient.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php
index ebe349573..b6feba35a 100644
--- a/inc/HTTPClient.php
+++ b/inc/HTTPClient.php
@@ -153,6 +153,29 @@ class HTTPClient {
}
/**
+ * Simple function to do a GET request with given parameters
+ *
+ * Returns the wanted page or false on an error.
+ *
+ * This is a convenience wrapper around get(). The given parameters
+ * will be correctly encoded and added to the given base URL.
+ *
+ * @param string $url The URL to fetch
+ * @param string $data Associative array of parameters
+ * @param bool $sloppy304 Return body on 304 not modified
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+ function dget($url,$data,$sloppy304=false){
+ if(strpos($url,'?')){
+ $url .= '&';
+ }else{
+ $url .= '?';
+ }
+ $url .= $this->_postEncode($data);
+ return $this->get($url,$sloppy304);
+ }
+
+ /**
* Simple function to do a POST request
*
* Returns the resulting page or false on an error;