public function setMethod($method = self::GET
) { if (!
preg_match('/^[^\x00-\x1f\x7f-\xff\(\)<>@,;:\\\\"\/\[\]\?={}\s]+$/',
$method)) { /** @see Zend_Http_Client_Exception */
throw new Zend_Http_Client_Exception("'{
$method}' is not a valid HTTP request method."
);
} if (($method == self::POST ||
$method == self::PUT ||
$method == self::DELETE
) &&
$this->enctype === null
) { $this->
setEncType(self::ENC_URLENCODED
);
} $this->method =
$method;
return $this;
} /**
* Set one or more request headers
*
* This function can be used in several ways to set the client's request
* headers:
* 1. By providing two parameters: $name as the header to set (e.g. 'Host')
* and $value as it's value (e.g. 'www.example.com').
* 2. By providing a single header string as the only parameter
* e.g. 'Host: www.example.com'
* 3. By providing an array of headers as the first parameter
* e.g. array('host' => 'www.example.com', 'x-foo: bar'). In This case
* the function will call itself recursively for each array item.
*
* @param string|array $name Header name, full header string ('Header: value')
* or an array of headers
* @param mixed $value Header value or null
* @return Zend_Http_Client
* @throws Zend_Http_Client_Exception
*/