Skip to content
Snippets Groups Projects
Commit 7e7f15ca authored by Andreas Gohr's avatar Andreas Gohr
Browse files

Convenience function in HTTPClient

The new dget() method works accepts URL parameters as associative
array (like the post() method).
parent ca0095d0
No related branches found
No related tags found
No related merge requests found
......@@ -152,6 +152,29 @@ class HTTPClient {
return $this->resp_body;
}
/**
* 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
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment