git-svn-id: https://svn.code.sf.net/p/phpxmlrpc/code/trunk/xmlrpc@56
013ecfd8-0664-425d-a759-
9c98391dc3f9
* server.php, testsuite.php: add a new test and server method for exception\r
catching in the server\r
\r
* server.php, testsuite.php: add a new test and server method for exception\r
catching in the server\r
\r
+ * xmlrpc.inc: added new method SetUserAgent to client to allow having different\r
+ user-agent http headers\r
+\r
2009-08-05 - G. Giunta (giunta.gaetano@gmail.com)\r
\r
* xmlrpc_wrappers.inc: improve compatibility with php 5.0 when registering\r
2009-08-05 - G. Giunta (giunta.gaetano@gmail.com)\r
\r
* xmlrpc_wrappers.inc: improve compatibility with php 5.0 when registering\r
var $proxy_pass='';\r
var $proxy_authtype=1;\r
var $cookies=array();\r
var $proxy_pass='';\r
var $proxy_authtype=1;\r
var $cookies=array();\r
- var $extracurlopts=array();\r
+ var $extracurlopts=array();\r
\r
/**\r
* List of http compression methods accepted by the client for responses.\r
\r
/**\r
* List of http compression methods accepted by the client for responses.\r
* valid strings are 'xmlrpcvals', 'phpvals' or 'xml'\r
*/\r
var $return_type = 'xmlrpcvals';\r
* valid strings are 'xmlrpcvals', 'phpvals' or 'xml'\r
*/\r
var $return_type = 'xmlrpcvals';\r
+ /**\r
+ * Sent to servers in http headers\r
+ */\r
+ var $user_agent;\r
\r
/**\r
* @param string $path either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php\r
\r
/**\r
* @param string $path either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php\r
\r
// by default the xml parser can support these 3 charset encodings\r
$this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');\r
\r
// by default the xml parser can support these 3 charset encodings\r
$this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');\r
+\r
+ // initialize user_agent string\r
+ $this->user_agent = $GLOBALS['xmlrpcName'] . ' ' . $GLOBALS['xmlrpcVersion'];\r
- /**\r
- * Directly set cURL options, for extra flexibility\r
- * It allows eg. to bind client to a specific IP interface / address\r
- * @param $options array\r
- */\r
- function SetCurlOptions( $options )\r
- {\r
- $this->extracurlopts = $options;\r
- }\r
+ /**\r
+ * Directly set cURL options, for extra flexibility\r
+ * It allows eg. to bind client to a specific IP interface / address\r
+ * @param $options array\r
+ */\r
+ function SetCurlOptions( $options )\r
+ {\r
+ $this->extracurlopts = $options;\r
+ }\r
+\r
+ /**\r
+ * Set user-agent string that will be used by this client instance\r
+ * in http headers sent to the server\r
+ */\r
+ function SetUserAgent( $agentstring )\r
+ {\r
+ $this->user_agent = $agentstring;\r
+ }\r
\r
/**\r
* Send an xmlrpc request\r
\r
/**\r
* Send an xmlrpc request\r
}\r
\r
$op= 'POST ' . $uri. " HTTP/1.0\r\n" .\r
}\r
\r
$op= 'POST ' . $uri. " HTTP/1.0\r\n" .\r
- 'User-Agent: ' . $GLOBALS['xmlrpcName'] . ' ' . $GLOBALS['xmlrpcVersion'] . "\r\n" .\r
+ 'User-Agent: ' . $this->user_agent . "\r\n" .\r
'Host: '. $server . ':' . $port . "\r\n" .\r
$credentials .\r
$proxy_credentials .\r
'Host: '. $server . ':' . $port . "\r\n" .\r
$credentials .\r
$proxy_credentials .\r
{\r
curl_setopt($curl, CURLOPT_VERBOSE, 1);\r
}\r
{\r
curl_setopt($curl, CURLOPT_VERBOSE, 1);\r
}\r
- curl_setopt($curl, CURLOPT_USERAGENT, $GLOBALS['xmlrpcName'].' '.$GLOBALS['xmlrpcVersion']);\r
+ curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);\r
// required for XMLRPC: post the data\r
curl_setopt($curl, CURLOPT_POST, 1);\r
// the data\r
// required for XMLRPC: post the data\r
curl_setopt($curl, CURLOPT_POST, 1);\r
// the data\r
else\r
{\r
$arr = array();\r
else\r
{\r
$arr = array();\r
while(list($k,$v) = each($php_val))\r
{\r
$arr[$k] = php_xmlrpc_encode($v, $options);\r
while(list($k,$v) = each($php_val))\r
{\r
$arr[$k] = php_xmlrpc_encode($v, $options);\r