diff options
author | Andreas Gohr <andi@splitbrain.org> | 2008-04-01 00:10:16 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2008-04-01 00:10:16 +0200 |
commit | 1a40d615b3b68e07480fd5d86e4e65c160bd2d64 (patch) | |
tree | 49a3c1d5025e79ec657c0be754a1beae5f2f066d /inc/HTTPClient.php | |
parent | 7e089c87a86bb19bfcb72fe835f4cfd3984eb992 (diff) | |
download | rpg-1a40d615b3b68e07480fd5d86e4e65c160bd2d64.tar.gz rpg-1a40d615b3b68e07480fd5d86e4e65c160bd2d64.tar.bz2 |
fixed bug in HTTPClient breaking GET requests on certain servers
The change of a parameter default made the HTTP client send data after
sending the headers for a GET request.
darcs-hash:20080331221016-7ad00-a46165b1ded7155a6482398c6bdf721a4eb37507.gz
Diffstat (limited to 'inc/HTTPClient.php')
-rw-r--r-- | inc/HTTPClient.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index d40a7b4db..e263989a4 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -148,13 +148,13 @@ class HTTPClient { * sent as is. You will need to setup your own Content-Type header then. * * @param string $url - the complete URL - * @param mixed $data - the post data + * @param mixed $data - the post data either as array or raw data * @param string $method - HTTP Method usually GET or POST. * @return bool - true on success * @author Andreas Goetz <cpuidle@gmx.de> * @author Andreas Gohr <andi@splitbrain.org> */ - function sendRequest($url,$data=array(),$method='GET'){ + function sendRequest($url,$data='',$method='GET'){ $this->start = $this->_time(); $this->error = ''; $this->status = 0; @@ -371,14 +371,16 @@ class HTTPClient { * * @author Andreas Gohr <andi@splitbrain.org> */ - function _debug($info,$var){ + function _debug($info,$var=null){ if(!$this->debug) return; print '<b>'.$info.'</b> '.($this->_time() - $this->start).'s<br />'; - ob_start(); - print_r($var); - $content = htmlspecialchars(ob_get_contents()); - ob_end_clean(); - print '<pre>'.$content.'</pre>'; + if(!is_null($var)){ + ob_start(); + print_r($var); + $content = htmlspecialchars(ob_get_contents()); + ob_end_clean(); + print '<pre>'.$content.'</pre>'; + } } /** |