当前位置: 首页>>代码示例>>PHP>>正文


PHP xmlrpc_client::setRequestCompression方法代码示例

本文整理汇总了PHP中xmlrpc_client::setRequestCompression方法的典型用法代码示例。如果您正苦于以下问题:PHP xmlrpc_client::setRequestCompression方法的具体用法?PHP xmlrpc_client::setRequestCompression怎么用?PHP xmlrpc_client::setRequestCompression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xmlrpc_client的用法示例。


在下文中一共展示了xmlrpc_client::setRequestCompression方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: forward_request

/**
 * Forward an xmlrpc request to another server, and return to client the response received.
 * @param xmlrpcmsg $m (see method docs below for a description of the expected parameters)
 * @return xmlrpcresp
 */
function forward_request($m)
{
    // create client
    $timeout = 0;
    $url = php_xmlrpc_decode($m->getParam(0));
    $c = new xmlrpc_client($url);
    if ($m->getNumParams() > 3) {
        // we have to set some options onto the client.
        // Note that if we do not untaint the received values, warnings might be generated...
        $options = php_xmlrpc_decode($m->getParam(3));
        foreach ($options as $key => $val) {
            switch ($key) {
                case 'Cookie':
                    break;
                case 'Credentials':
                    break;
                case 'RequestCompression':
                    $c->setRequestCompression($val);
                    break;
                case 'SSLVerifyHost':
                    $c->setSSLVerifyHost($val);
                    break;
                case 'SSLVerifyPeer':
                    $c->setSSLVerifyPeer($val);
                    break;
                case 'Timeout':
                    $timeout = (int) $val;
                    break;
            }
            // switch
        }
    }
    // build call for remote server
    /// @todo find a weay to forward client info (such as IP) to server, either
    /// - as xml comments in the payload, or
    /// - using std http header conventions, such as X-forwarded-for...
    $method = php_xmlrpc_decode($m->getParam(1));
    $pars = $m->getParam(2);
    $m = new xmlrpcmsg($method);
    for ($i = 0; $i < $pars->arraySize(); $i++) {
        $m->addParam($pars->arraymem($i));
    }
    // add debug info into response we give back to caller
    xmlrpc_debugmsg("Sending to server {$url} the payload: " . $m->serialize());
    return $c->send($m, $timeout);
}
开发者ID:5haman,项目名称:knowledgetree,代码行数:51,代码来源:proxy.php


注:本文中的xmlrpc_client::setRequestCompression方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。