7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
17 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
22 /** Zend_Http_Client */
23 require_once 'Zend/Http/Client.php';
28 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
29 * @license http://framework.zend.com/license/new-bsd New BSD License
33 const REQUEST_SCHEME_HEADER
= 'header';
34 const REQUEST_SCHEME_POSTBODY
= 'postbody';
35 const REQUEST_SCHEME_QUERYSTRING
= 'querystring';
39 const DELETE
= 'DELETE';
43 * Singleton instance if required of the HTTP client
45 * @var Zend_Http_Client
47 protected static $httpClient = null;
50 * Allows the external environment to make Zend_Oauth use a specific
53 * @param Zend_Http_Client $httpClient
56 public static function setHttpClient(Zend_Http_Client
$httpClient)
58 self
::$httpClient = $httpClient;
62 * Return the singleton instance of the HTTP Client. Note that
63 * the instance is reset and cleared of previous parameters and
64 * Authorization header values.
66 * @return Zend_Http_Client
68 public static function getHttpClient()
70 if (!isset(self
::$httpClient)) {
71 self
::$httpClient = new Zend_Http_Client
;
73 self
::$httpClient->setHeaders('Authorization', null);
74 self
::$httpClient->resetParameters();
76 return self
::$httpClient;
80 * Simple mechanism to delete the entire singleton HTTP Client instance
81 * which forces an new instantiation for subsequent requests.
85 public static function clearHttpClient()
87 self
::$httpClient = null;