Definition at line 58 of file HTTPRequest.php.
◆ __construct()
XML_RPC2_Util_HTTPRequest::__construct |
( |
|
$uri = '' , |
|
|
|
$params = array() |
|
) |
| |
Constructor.
Sets up the object
- Parameters
-
string | The uri to fetch/access |
array | Associative array of parameters which can have the following keys:
-
proxy - Proxy (string)
-
encoding - The request encoding (string)
public |
Definition at line 146 of file HTTPRequest.php.
148 if (!preg_match(
'/(https?:\/\/)(.*)/', $uri))
throw new XML_RPC2_Exception(
'Unable to parse URI');
150 if (isset($params[
'encoding'])) {
151 $this->_encoding = $params[
'encoding'];
153 if (isset($params[
'proxy'])) {
154 $proxy = $params[
'proxy'];
155 $elements = parse_url($proxy);
156 if (is_array($elements)) {
157 if ((isset($elements[
'scheme'])) and (isset($elements[
'host']))) {
158 $this->_proxy = $elements[
'scheme'] .
'://' . $elements[
'host'];
160 if (isset($elements[
'port'])) {
161 $this->_proxy = $this->_proxy .
':' . $elements[
'port'];
163 if ((isset($elements[
'user'])) and (isset($elements[
'pass']))) {
164 $this->_proxyAuth = $elements[
'user'] .
':' . $elements[
'pass'];
168 if (isset($params[
'sslverify'])) {
169 $this->_sslverify = $params[
'sslverify'];
◆ getBody()
XML_RPC2_Util_HTTPRequest::getBody |
( |
| ) |
|
body field getter
- Returns
- string body value
Definition at line 113 of file HTTPRequest.php.
◆ sendRequest()
XML_RPC2_Util_HTTPRequest::sendRequest |
( |
| ) |
|
Sends the request.
public
- Returns
- mixed PEAR error on error, true otherwise
Definition at line 182 of file HTTPRequest.php.
References $result, and XML_RPC2_Client\VERSION.
184 if (!function_exists(
'curl_init') &&
186 @dl(
'php_curl' . PHP_SHLIB_SUFFIX) || @dl(
'curl' . PHP_SHLIB_SUFFIX)
190 if ($ch = curl_init()) {
192 (is_null($this->_proxy) || curl_setopt($ch, CURLOPT_PROXY, $this->_proxy)) &&
193 (is_null($this->_proxyAuth) || curl_setopt($ch, CURLOPT_PROXYUSERPWD, $this->_proxyAuth)) &&
194 curl_setopt($ch, CURLOPT_URL, $this->_uri) &&
195 curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE) &&
196 curl_setopt($ch, CURLOPT_POST, 1) &&
197 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->_sslverify) &&
198 curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-type: text/xml; charset='.$this->_encoding,
'User-Agent: PEAR_XML_RCP2/' .
XML_RPC2_Client::VERSION)) &&
199 curl_setopt($ch, CURLOPT_POSTFIELDS, $this->_postData)
202 if (($errno = curl_errno($ch)) != 0) {
205 $info = curl_getinfo($ch);
206 if ($info[
'http_code'] != 200) {
◆ setPostData()
XML_RPC2_Util_HTTPRequest::setPostData |
( |
|
$value | ) |
|
postData field setter
- Parameters
-
Definition at line 126 of file HTTPRequest.php.
128 $this->_postData = $value;
◆ $_encoding
XML_RPC2_Util_HTTPRequest::$_encoding ='iso-8859-1' |
|
private |
◆ $_postData
XML_RPC2_Util_HTTPRequest::$_postData |
|
private |
◆ $_proxy
XML_RPC2_Util_HTTPRequest::$_proxy = null |
|
private |
◆ $_proxyAuth
XML_RPC2_Util_HTTPRequest::$_proxyAuth = null |
|
private |
◆ $_sslverify
XML_RPC2_Util_HTTPRequest::$_sslverify =true |
|
private |
◆ $_uri
XML_RPC2_Util_HTTPRequest::$_uri |
|
private |
The documentation for this class was generated from the following file: