Zend_Http_Client::resetParameters PHP Method

resetParameters() public method

Should be used to reset the request parameters if the client is used for several concurrent requests. clearAll parameter controls if we clean just parameters or also headers and last_*
public resetParameters ( boolean $clearAll = false ) : Zend_Http_Client
$clearAll boolean Should all data be cleared?
return Zend_Http_Client
    public function resetParameters($clearAll = false)
    {
        // Reset parameter data
        $this->paramsGet = array();
        $this->paramsPost = array();
        $this->files = array();
        $this->raw_post_data = null;
        $this->enctype = null;
        if ($clearAll) {
            $this->headers = array();
            $this->last_request = null;
            $this->last_response = null;
        } else {
            // Clear outdated headers
            if (isset($this->headers[strtolower(self::CONTENT_TYPE)])) {
                unset($this->headers[strtolower(self::CONTENT_TYPE)]);
            }
            if (isset($this->headers[strtolower(self::CONTENT_LENGTH)])) {
                unset($this->headers[strtolower(self::CONTENT_LENGTH)]);
            }
        }
        return $this;
    }

Usage Example

Beispiel #1
0
 /**
  * HTTP client preparation procedures - should be called before every API 
  * call. 
  * 
  * Will clean up the HTTP client parameters, set the request method to POST
  * and add the always-required authentication information
  * 
  * @param  string $method The API method we are about to use
  * @return void
  */
 protected function prepare($method)
 {
     // Reset parameters
     $this->httpClient->resetParameters();
     // Add authentication data
     $this->httpClient->setMethod('POST');
     $this->httpClient->setParameterPost(array('USER' => $this->authInfo->getUser(), 'PWD' => $this->authInfo->getPassword(), 'SIGNATURE' => $this->authInfo->getSignature(), 'VERSION' => '2.3', 'METHOD' => $method));
 }
All Usage Examples Of Zend_Http_Client::resetParameters