本文整理汇总了PHP中xmlrpcmsg::addparam方法的典型用法代码示例。如果您正苦于以下问题:PHP xmlrpcmsg::addparam方法的具体用法?PHP xmlrpcmsg::addparam怎么用?PHP xmlrpcmsg::addparam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmlrpcmsg
的用法示例。
在下文中一共展示了xmlrpcmsg::addparam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _xmlrpc_j2xml_send
/**
* Send xml data to
* @param string $remote_url
* @param string $xml
* @param string $username
* @param string $password
* @param int $debug when 1 (or 2) will enable debugging of the underlying xmlrpc call (defaults to 0)
* @return xmlrpcresp obj instance
*/
private static function _xmlrpc_j2xml_send($remote_url, $xml, $username, $password, $debug = 0)
{
$protocol = '';
$GLOBALS['xmlrpc_internalencoding'] = 'UTF-8';
$client = new xmlrpc_client($remote_url);
$client->return_type = 'xmlrpcvals';
$client->request_charset_encoding = 'UTF-8';
$client->user_agent = J2XMLVersion::$PRODUCT . ' ' . J2XMLVersion::getFullVersion();
$client->setDebug($debug);
$msg = new xmlrpcmsg('j2xml.import');
$p1 = new xmlrpcval(base64_encode($xml), 'base64');
$msg->addparam($p1);
$p2 = new xmlrpcval($username, 'string');
$msg->addparam($p2);
$p3 = new xmlrpcval($password, 'string');
$msg->addparam($p3);
$res = $client->send($msg, 0);
if (!$res->faultcode()) {
return $res;
}
if ($res->faultString() == "Didn't receive 200 OK from remote server. (HTTP/1.1 301 Foun)") {
$res = $client->send($msg, 0, $protocol = 'http11');
if (!$res->faultcode()) {
return $res;
}
}
if ($res->faultString() == "Didn't receive 200 OK from remote server. (HTTP/1.1 303 See other)") {
$headers = http_parse_headers($res->raw_data);
$client = new xmlrpc_client($headers['Location']);
$client->return_type = 'xmlrpcvals';
$client->request_charset_encoding = 'UTF-8';
$client->user_agent = J2XMLVersion::$PRODUCT . ' ' . J2XMLVersion::getFullVersion();
$client->setDebug($debug);
$res = $client->send($msg, 0, $protocol);
}
return $res;
}