/** * @return HTTP_Request2 * @throws BuildException * @throws HTTP_Request2_LogicException */ protected function createRequest() { if (!isset($this->dir)) { throw new BuildException("Required attribute 'dir' is missing"); } $config = array('ssl_verify_peer' => $this->sslVerifyPeer); if (isset($this->proxy)) { $config['proxy'] = $this->proxy; } if (null !== $this->followRedirects) { $config['follow_redirects'] = $this->followRedirects; } $request = parent::createRequest(); $request->setConfig($config); $this->log("Fetching " . $this->url); return $request; }
/** * Creates and configures an instance of HTTP_Request2 * * @return HTTP_Request2 */ protected function createRequest() { $request = parent::createRequest(); if ($this->method == HTTP_Request2::METHOD_POST) { $request->setMethod(HTTP_Request2::METHOD_POST); foreach ($this->postParameters as $postParameter) { $request->addPostParameter($postParameter->getName(), $postParameter->getValue()); } } if ($this->verbose) { $observer = new HTTP_Request2_Observer_Log(); // set the events we want to log $observer->events = $this->observerEvents; $request->attach($observer); } return $request; }