_class($url); $http = new $class($url); $http->timeout = $this->timeout; $http->max_redirects = $this->max_redirects; return $http->get($url); } public function post($url, $body, $headers=array()) { $class = $this->_class($url); $http = new $class($url); $http->timeout = $this->timeout; $http->max_redirects = $this->max_redirects; return $http->post($url, $body, $headers); } public function head($url) { $class = $this->_class($url); $http = new $class($url); $http->timeout = $this->timeout; $http->max_redirects = $this->max_redirects; return $http->head($url); } private function _class($url) { if(!should_follow_redirects($url)) { return 'p3k\HTTPStream'; } else { return 'p3k\HTTPCurl'; } } }