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


PHP php_xmlrpc_encode函数代码示例

本文整理汇总了PHP中php_xmlrpc_encode函数的典型用法代码示例。如果您正苦于以下问题:PHP php_xmlrpc_encode函数的具体用法?PHP php_xmlrpc_encode怎么用?PHP php_xmlrpc_encode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getcomments

function getcomments($m)
{
    global $xmlrpcerruser;
    $err = "";
    $ra = array();
    // get the first param
    if (XMLRPC_EPI_ENABLED == '1') {
        $msgID = xmlrpc_decode($m->getParam(0));
    } else {
        $msgID = php_xmlrpc_decode($m->getParam(0));
    }
    $dbh = dba_open("/tmp/comments.db", "r", "db2");
    if ($dbh) {
        $countID = "{$msgID}_count";
        if (dba_exists($countID, $dbh)) {
            $count = dba_fetch($countID, $dbh);
            for ($i = 0; $i < $count; $i++) {
                $name = dba_fetch("{$msgID}_name_{$i}", $dbh);
                $comment = dba_fetch("{$msgID}_comment_{$i}", $dbh);
                // push a new struct onto the return array
                $ra[] = array("name" => $name, "comment" => $comment);
            }
        }
    }
    // if we generated an error, create an error return response
    if ($err) {
        return new xmlrpcresp(0, $xmlrpcerruser, $err);
    } else {
        // otherwise, we create the right response
        // with the state name
        return new xmlrpcresp(php_xmlrpc_encode($ra));
    }
}
开发者ID:partisan-collective,项目名称:partisan,代码行数:33,代码来源:discuss.php

示例2: syncStoreAtOdoo

 public function syncStoreAtOdoo($store_data)
 {
     $response = 0;
     $auto_warehouse_generation = Mage::getStoreConfig('magerpsync/mobmultishop/auto_warehouse_generation');
     $auto_pricelist_generation = Mage::getStoreConfig('magerpsync/mobmultishop/auto_pricelist_generation');
     $store_data['auto_warehouse'] = $auto_warehouse_generation;
     $store_data['auto_pricelist'] = $auto_pricelist_generation;
     $store_array = php_xmlrpc_encode($store_data);
     $helper = Mage::helper('magerpsync/connection');
     $context = $helper->getOdooContext();
     $client = $helper->getClientConnect();
     $userId = Mage::getSingleton('adminhtml/session')->getUserId();
     $msg = new xmlrpcmsg('execute');
     $msg->addParam(new xmlrpcval($helper::$odoo_db, "string"));
     $msg->addParam(new xmlrpcval($userId, "int"));
     $msg->addParam(new xmlrpcval($helper::$odoo_pwd, "string"));
     $msg->addParam(new xmlrpcval("magento.store.view", "string"));
     $msg->addParam(new xmlrpcval("sync_store_view", "string"));
     $msg->addParam($store_array);
     $msg->addParam(new xmlrpcval($context, "struct"));
     $resp = $client->send($msg);
     if ($resp->faultCode()) {
         $error = "Sync Error, Store " . $store_data['name'] . " >>" . $resp->faultString();
         Mage::log($error, null, 'odoo_connector.log');
     } else {
         $response = 1;
         $odoo_id = $resp->value()->me["int"];
         $store = Mage::getModel("mobmultishop/mobmultishop");
         $store->setOdooStoreId($odoo_id);
         $store->setMageStoreId($store_data['store_id']);
         $store->setCreatedBy($helper::$mage_user);
         $store->save();
     }
     return $response;
 }
开发者ID:babycarenl,项目名称:360,代码行数:35,代码来源:Mobmultishop.php

示例3: call

 function call($method_name, &$args)
 {
     $xmlrpc_args = array();
     foreach ($args as $arg) {
         $xmlrpc_args[] = php_xmlrpc_encode($arg);
     }
     $xmlrpc_return = $this->client->send(new xmlrpcmsg($method_name, $xmlrpc_args), 300);
     return $xmlrpc_return->value();
 }
开发者ID:ratbird,项目名称:hope,代码行数:9,代码来源:xml_rpc_webservice_client.php

示例4: addArg

 /**
  * addArg adds an argument to the args array to pass to the function
  *
  * @param variable args - Either a single argument or an array of arguments
  */
 function addArg()
 {
     $func_args = func_get_args();
     $func_args = $func_args[0];
     if (is_array($func_args)) {
         foreach ($func_args as $arg) {
             $this->_args[] = php_xmlrpc_encode($arg);
         }
     } else {
         $this->_args[] = php_xmlrpc_encode($func_args);
     }
 }
开发者ID:n2i,项目名称:xvnkb,代码行数:17,代码来源:client.php

示例5: exec

 function exec($method, $params = NULL)
 {
     $message = new xmlrpcmsg($method);
     if ($params && is_array($params)) {
         foreach ($params as $value) {
             $message->addParam(php_xmlrpc_encode($value));
         }
     }
     $result = $this->db->send($message, 15);
     if ($result->faultCode()) {
         throw new Exception($result->faultString());
     }
     return $result->value();
 }
开发者ID:karepwes,项目名称:OcsPanels,代码行数:14,代码来源:webmin.php

示例6: getTagId

function getTagId($tag)
{
    global $client, $key;
    $call = new xmlrpcmsg("DataService.query", array(php_xmlrpc_encode($key), php_xmlrpc_encode("ContactGroup"), php_xmlrpc_encode(5000), php_xmlrpc_encode(0), php_xmlrpc_encode(array('Id' => '%')), php_xmlrpc_encode(array('Id', 'GroupName')), php_xmlrpc_encode('GroupName'), php_xmlrpc_encode(true)));
    ###Send the call###
    $result = $client->send($call);
    $tagArray = $result->val;
    for ($i = 0; $i < count($tagArray); ++$i) {
        if ($tagArray[$i]["GroupName"] == $tag) {
            $tagId = $tagArray[$i]["Id"];
        }
    }
    return $tagId;
}
开发者ID:RiquelmyMelara,项目名称:Awakened-Millionaire,代码行数:14,代码来源:functions.php

示例7: dispatch

 /**
  * <MethodDescription>
  *
  * @param string <description>
  *
  * @return mixed <description>
  */
 function dispatch($msg = NULL)
 {
     # ensure correct invocation
     if (is_null($msg) || !is_a($msg, 'xmlrpcmsg')) {
         return $this->throw_exception('functions_parameters_type must not be ' . 'phpvals.');
     }
     # get decoded parameters
     $len = $msg->getNumParams();
     $argument_array = array();
     for ($i = 0; $i < $len; ++$i) {
         $argument_array[] = php_xmlrpc_decode($msg->getParam($i));
     }
     # return result
     return new xmlrpcresp(php_xmlrpc_encode($this->invoke($msg->method(), $argument_array)));
 }
开发者ID:ratbird,项目名称:hope,代码行数:22,代码来源:xmlrpc_dispatcher.php

示例8: addCamp

function addCamp($CID, $CMP)
{
    ###Set up global variables###
    global $client, $key;
    ###Set up the call to add to the campaign###
    $call = new xmlrpcmsg("ContactService.addToCampaign", array(php_xmlrpc_encode($key), php_xmlrpc_encode($CID), php_xmlrpc_encode($CMP)));
    ###Send the call###
    $result = $client->send($call);
    if (!$result->faultCode()) {
        print "Contact added to Campaign " . $CMP;
        print "<BR>";
    } else {
        print $result->faultCode() . "<BR>";
        print $result->faultString() . "<BR>";
    }
}
开发者ID:nickellison,项目名称:API-Sample-Code,代码行数:16,代码来源:ContactService-Sample.php

示例9: sendXmlRpc

 function sendXmlRpc($sMessage, $aParam)
 {
     $r_client = new xmlrpc_client(ADDR_XMLRPC_ENTERPOINT, ADDR_XMLRPC_SERVER, 80);
     foreach ($aParam as $k => $v) {
         $aParam[$k] = php_xmlrpc_encode($v);
     }
     $r_message = new xmlrpcmsg($sMessage, $aParam);
     //$c->setDebug(1);
     $response =& $r_client->send($r_message);
     if ($response->faultCode()) {
         return $response;
         return 'xmlrpc-error: ' . $file . ' [' . $r->faultCode() . '] ' . $r->faultString();
     }
     $value = $response->value();
     return php_xmlrpc_decode($value);
 }
开发者ID:rigidus,项目名称:cobutilniki,代码行数:16,代码来源:update.php

示例10: addCard

function addCard($CC)
{
    global $client, $key;
    ###Set up the call to add the card###
    $call = new xmlrpcmsg("DataService.add", array(php_xmlrpc_encode($key), php_xmlrpc_encode("CreditCard"), php_xmlrpc_encode($CC)));
    ###Send the call###
    $result = $client->send($call);
    if (!$result->faultCode()) {
        $cardID = $result->value();
        print "Credit Card added - ID: " . $cardID;
        print "<BR>";
    } else {
        print $result->faultCode() . "<BR>";
        print $result->faultString() . "<BR>";
    }
    return $cardID;
}
开发者ID:luka-php,项目名称:API-Sample-Code,代码行数:17,代码来源:DataService-Sample.php

示例11: addOrderItem

function addOrderItem($oID, $pID, $Type, $Price, $qty, $desc, $notes)
{
    global $client, $key;
    ###   Set up the call to add an item   ###
    $call = new xmlrpcmsg("InvoiceService.addOrderItem", array(php_xmlrpc_encode($key), php_xmlrpc_encode($oID), php_xmlrpc_encode($pID), php_xmlrpc_encode($Type), php_xmlrpc_encode($Price), php_xmlrpc_encode($qty), php_xmlrpc_encode($desc), php_xmlrpc_encode($notes)));
    ###Send the call###
    $result = $client->send($call);
    if (!$result->faultCode()) {
        $itemID = $result->value();
        print "Order Item added: " . $desc;
        print "<BR>";
        return $itemID;
    } else {
        print $result->faultCode() . "<BR>";
        print $result->faultString() . "<BR>";
    }
}
开发者ID:luka-php,项目名称:API-Sample-Code,代码行数:17,代码来源:ProcessSale.php

示例12: buildOrder

function buildOrder($cID, $desc, $oDate, $leadAff, $saleAff)
{
    global $client, $key;
    ###Set up the call to add an order to a contact###
    $call = new xmlrpcmsg("InvoiceService.createBlankOrder", array(php_xmlrpc_encode($key), php_xmlrpc_encode($cID), php_xmlrpc_encode($desc), php_xmlrpc_encode($oDate, array('auto_dates')), php_xmlrpc_encode($leadAff), php_xmlrpc_encode($saleAff)));
    ###Send the call###
    $result = $client->send($call);
    if (!$result->faultCode()) {
        $ordID = $result->value();
        print "Blank order built - ID: " . $ordID;
        print "<BR>";
        return $ordID;
    } else {
        print $result->faultCode() . "<BR>";
        print $result->faultString() . "<BR>";
    }
}
开发者ID:luka-php,项目名称:API-Sample-Code,代码行数:17,代码来源:InvoiceService-Sample.php

示例13: xmlrpccall_simple

/**
 * Takes a client object, a remote method name, and a variable numbers of
 * php values, and calls the method with the supplied parameters. The 
 * parameters are native php values and the result is an xmlrpcresp object.
 *
 * Notes:
 * The function encodes the received parameters using php_xmlrpc_encode:
 * the limitations of automatic encoding apply to this function too);
 *
 * the type of the value returned by the function can be changed setting
 * beforehand the 'return_type' member of the client object to 'phpvals' -
 * see the manual for more details about this capability).
 *
 *
 * @author Toth Istvan
 *
 * @param xmlrpc_client client object, properly set up to connect to server
 * @param string remote function name
 * @param mixed $parameter1
 * @param mixed $parameter2
 * @param mixed $parameter3 ...
 * @return xmlrpcresp or false on error
 */
function xmlrpccall_simple()
{
    if (func_num_args() < 2) {
        // Incorrect
        return false;
    } else {
        $varargs = func_get_args();
        $client = array_shift($varargs);
        $remote_function_name = array_shift($varargs);
        if (!is_a($client, 'xmlrpc_client') || !is_string($remote_function_name)) {
            return false;
        }
        $xmlrpcval_array = array();
        foreach ($varargs as $parameter) {
            $xmlrpcval_array[] = php_xmlrpc_encode($parameter);
        }
        return $client->send(new xmlrpcmsg($remote_function_name, $xmlrpcval_array));
    }
}
开发者ID:caseysoftware,项目名称:web2project-planner,代码行数:42,代码来源:simple_call.php

示例14: sendWithoutAddingKey

 public function sendWithoutAddingKey($method, $args, $retry = false)
 {
     $encoded_arguments = array();
     foreach ($args as $argument) {
         $encoded_arguments[] = php_xmlrpc_encode($argument, array('auto_dates'));
     }
     $call = new xmlrpcmsg($method, $encoded_arguments);
     $attempts = 0;
     $start = time();
     $req = null;
     do {
         if ($attempts > 0) {
             if (class_exists('CakeLog') && $attempts > 1) {
                 $lastAttemptFaultCode = $req->faultCode();
                 $lastAttemptFaultString = $req->faultString();
             }
             sleep(5);
         }
         $attempts++;
         $req = $this->client->send($call, $this->timeout, 'https');
     } while ($retry && ($req->faultCode() == $GLOBALS['xmlrpcerr']['invalid_return'] || $req->faultCode() == $GLOBALS['xmlrpcerr']['curl_fail'] || strpos($req->faultString(), 'com.infusionsoft.throttle.ThrottlingException: Maximum number of threads throttled') !== false) && $attempts < 3);
     $this->totalHttpCalls += $attempts;
     if (!$req->faultCode()) {
         $result = php_xmlrpc_decode($req->value());
     } else {
         $result = array();
     }
     if (is_object($this->Logger)) {
         $this->Logger->log(array('time' => date('Y-m-d H:i:s'), 'duration' => time() - $start, 'method' => $method, 'args' => $args, 'attempts' => $attempts, 'result' => $req->faultCode() ? 'Failed' : count($result) . ' Records Returned', 'error_message' => $req->faultCode() ? $req->faultString() : null));
     }
     if ($req->faultCode()) {
         $exception = new Infusionsoft_Exception($req->faultString() . "\nAttempted: {$attempts} time(s).", $method, $args);
         $this->addException($exception);
         throw $exception;
         return FALSE;
     }
     if ($attempts > 2) {
         CakeLog::write('notice', "Infusionsoft call required {$attempts} calls to receive a successful response. Method: {$method} FaultCode: {$lastAttemptFaultCode} FaultString: {$lastAttemptFaultString}");
     }
     return $result;
 }
开发者ID:s1mple,项目名称:infusionsoft-php-sdk,代码行数:41,代码来源:App.php

示例15: addCamp

function addCamp($CID, $FUS)
{
    ###Set up global variables###
    global $client, $key;
    ################################################################################
    ### Note: at the time that the API was written "Campaigns" were actually     ###
    ### Follow up sequences. This is why the action to add a user to a Follow up ###
    ### sequence is called "addToCampaign".										 ###
    ###                                                                          ###
    ################################################################################
    ###Set up the call to add to the Follow up sequence###
    $call = new xmlrpcmsg("ContactService.addToCampaign", array(php_xmlrpc_encode($key), php_xmlrpc_encode($CID), php_xmlrpc_encode($FUS)));
    ###Send the call###
    $result = $client->send($call);
    if (!$result->faultCode()) {
        print "Contact added to Follow up sequence " . $CMP;
        print "<BR>";
    } else {
        print $result->faultCode() . "<BR>";
        print $result->faultString() . "<BR>";
    }
}
开发者ID:luka-php,项目名称:API-Sample-Code,代码行数:22,代码来源:ContactService-Sample.php


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