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
* 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
// 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
\r
/**\r
}\r
}\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
+ * 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
$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
{\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
else\r
{\r
$arr = array();\r
- reset($php_val);\r
+ reset($php_val);\r
while(list($k,$v) = each($php_val))\r
{\r
$arr[$k] = php_xmlrpc_encode($v, $options);\r