本文整理汇总了PHP中xmlrpc_server_destroy函数的典型用法代码示例。如果您正苦于以下问题:PHP xmlrpc_server_destroy函数的具体用法?PHP xmlrpc_server_destroy怎么用?PHP xmlrpc_server_destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmlrpc_server_destroy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __destruct
/**
* Destroys a class instance.
*/
public function __destruct()
{
parent::__destruct();
if (is_resource($this->server)) {
xmlrpc_server_destroy($this->server);
}
}
开发者ID:jyxo,项目名称:php,代码行数:10,代码来源:Server.php
示例2: handlePost
function handlePost()
{
$server = xmlrpc_server_create();
xmlrpc_server_register_method($server, 'pingback.ping', array($this, 'ping'));
echo xmlrpc_server_call_method($server, file_get_contents('php://input'), null, array('encoding' => 'utf-8'));
xmlrpc_server_destroy($server);
return true;
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:8,代码来源:pingback.php
示例3: process
/**
* Processes an incoming request, executes it and builds a response.
*
* @since 5.1
* @param ModuleServerRequest $request Incoming request.
* @param ModuleServerResponse $response Outcoming response.
* @return void
*/
public function process(ModuleServerRequest $request, ModuleServerResponse $response)
{
$command = explode(' ', $request->getCommand());
$module_location = $command[1];
if (!strlen($module_location)) {
$response->sendWarning(ModuleServerResponse::SC_NOT_FOUND, 'Module location not defined.', ModuleServerRsponse::ERROR_CLASSNAME_MISSING);
return;
}
try {
$locator = new ModuleLocator('module://' . $request->getHeader('User') . ':' . $request->getHeader('Password') . '@/' . $module_location);
$sessionId = $request->getHeader('Session');
if ($sessionId) {
$this->module = ModuleFactory::getSessionModule($locator, $sessionId);
} else {
$this->module = ModuleFactory::getModule($locator);
}
} catch (ModuleException $e) {
$response->sendWarning(ModuleServerResponse::SC_INTERNAL_SERVER_ERROR, $e->__toString());
return;
} catch (\Exception $e) {
$response->sendWarning(ModuleServerResponse::SC_INTERNAL_SERVER_ERROR, $e->__toString());
return;
}
if (!($xmlrpc_server = xmlrpc_server_create())) {
$response->sendWarning(ModuleServerResponse::SC_INTERNAL_SERVER_ERROR, 'Internal error: Could not create an XML-RPC server.', ModuleServerResponse::ERROR_XMLRPC_ERROR);
return;
}
$theClass = new \ReflectionObject($this->module);
$methods = $theClass->getMethods();
foreach ($methods as $method) {
// Ignore private methods
$theMethod = new \ReflectionMethod($theClass->getName(), $method->getName());
if (!$theMethod->isPublic()) {
continue;
}
// Expose only methods beginning with "module" prefix
if (!(substr($method->getName(), 0, 6) == 'module')) {
continue;
}
xmlrpc_server_register_method($xmlrpc_server, strtolower($method->getName()), array($this, 'xmlrpcGateway'));
}
xmlrpc_server_register_introspection_callback($xmlrpc_server, array($this, 'introspectionGateway'));
try {
$buffer = xmlrpc_server_call_method($xmlrpc_server, $request->getPayload(), '', array('output_type' => 'xml'));
$response->addHeader('Module/1.0 ' . ModuleServerResponse::SC_OK);
$response->setBuffer($buffer);
} catch (\Exception $e) {
$response->addHeader('Module/1.0 ' . ModuleServerResponse::SC_INTERNAL_ERROR);
$response->setBuffer($buffer);
}
xmlrpc_server_destroy($xmlrpc_server);
$context = new ModuleContext($module_location);
$session = new \Innomatic\Module\Session\ModuleSession($context, $sessionId);
$session->save($this->module);
$response->addHeader('Session: ' . $session->getId());
}
开发者ID:kchizi,项目名称:innomatic-legacy,代码行数:64,代码来源:ModuleServerXmlRpcProcessor.php
示例4: __construct
function __construct($payload, $payload_signed, $payload_encrypted)
{
$this->payload = $payload;
// xmlrpc_decode_request is defined such that the '$method' string is
// passed in by reference.
$this->params = xmlrpc_decode_request($this->payload, $this->method, 'UTF-8');
// The method name is not allowed to have a dot, except for a single dot
// which preceeds the php extension. It can have slashes but it cannot
// begin with a slash. We specifically don't want .. to be possible.
if (0 == preg_match("@^[A-Za-z0-9]+/[A-Za-z0-9/_-]+(\\.php/)?[A-Za-z0-9_-]+\$@", $this->method)) {
throw new XmlrpcServerException('The function does not exist', 6010);
}
if ($payload_signed && $payload_encrypted || $this->method == 'system/keyswap') {
// The remote server's credentials checked out.
// You might want to enable some methods for unsigned/unencrypted
// transport
} else {
// For now, we throw an exception
throw new XmlrpcServerException('The signature on your message was not valid', 6005);
}
// The system methods are treated differently.
if (array_key_exists($this->method, $this->system_methods)) {
$xmlrpcserver = xmlrpc_server_create();
xmlrpc_server_register_method($xmlrpcserver, $this->method, array(&$this, $this->system_methods[$this->method]));
} else {
// Security: I'm thinking that we should not return separate errors for
// the file not existing, the file not being readable, etc. as
// it might provide an opportunity for outsiders to scan the
// server for random files. So just a single message/code for
// all failures here kthxbye.
if (strpos($this->method, '/') !== false) {
$this->callstack = explode('/', $this->method);
} else {
throw new XmlrpcServerException('The function does not exist', 6011);
}
// Read custom xmlrpc functions from local
if (function_exists('local_xmlrpc_services')) {
foreach (local_xmlrpc_services() as $name => $localservices) {
$this->services[$name] = array_merge($this->services[$name], $localservices);
}
}
foreach ($this->services as $container) {
if (array_key_exists($this->method, $container)) {
$xmlrpcserver = xmlrpc_server_create();
$bool = xmlrpc_server_register_method($xmlrpcserver, $this->method, 'api_dummy_method');
$this->response = xmlrpc_server_call_method($xmlrpcserver, $payload, $container[$this->method], array("encoding" => "utf-8"));
$bool = xmlrpc_server_destroy($xmlrpcserver);
return $this->response;
}
}
throw new XmlrpcServerException('No such method: ' . $this->method);
}
$temp = '';
$this->response = xmlrpc_server_call_method($xmlrpcserver, $payload, $temp, array("encoding" => "utf-8"));
return $this->response;
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:56,代码来源:dispatcher.php
示例5: processRequest
/**
* Request processor
* @param object $handler
* @param array|bool $methodsList If omitted, handler should contain getMethods() method
* @return string
*/
public function processRequest($handler, $methodsList = false)
{
$server = xmlrpc_server_create();
if (!$methodsList) {
$methodsList = $handler->getMethods();
}
foreach ($methodsList as $method) {
xmlrpc_server_register_method($server, $method, [$handler, $method]);
}
$request = (isset($HTTP_RAW_POST_DATA) and $HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents('php://input');
$response = xmlrpc_server_call_method($server, $request, null);
xmlrpc_server_destroy($server);
return $response;
}
开发者ID:difra-org,项目名称:difra,代码行数:20,代码来源:XMLRPC.php
示例6: setUpXmlRpcTypes
private function setUpXmlRpcTypes($xmlrpc_das)
{
$typeList = <<<END
<introspection>
<typeList>
<typeDescription name='SimpleType' basetype='struct' desc='Simple type'>
<value type='int' name='intValue'></value>
<value type='double' name='doubleValue'></value>
<value type='string' name='strValue'></value>
</typeDescription>
<typeDescription name='ComplexType' basetype='struct' desc='Complex type'>
<value type='SimpleType []' name='objArrValue'></value>
<value type='int []' name='intArrValue'></value>
<value type='int' name='intValue'></value>
<value type='double' name='doubleValue'></value>
<value type='string' name='strValue'></value>
<value type='SimpleType' name='objValue'></value>
</typeDescription>
</typeList>
</introspection>
END;
$call = <<<END
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>system.describeMethods</methodName>
<params/>
</methodCall>
END;
$xmlrpc_server = xmlrpc_server_create();
$descArray = xmlrpc_parse_method_descriptions($typeList);
xmlrpc_server_add_introspection_data($xmlrpc_server, $descArray);
$response = xmlrpc_server_call_method($xmlrpc_server, $call, null);
xmlrpc_server_destroy($xmlrpc_server);
$methodDesc = xmlrpc_decode_request($response, $method);
$this->xmlrpc_das->addTypesXmlRpc($methodDesc["typeList"]);
}
开发者ID:psagi,项目名称:sdo,代码行数:42,代码来源:XmlRpcTest.php
示例7: generate
/**
* Generate
*
* @param string $service_description Service Description
*
* @return null
*/
public function generate($service_description)
{
SCA::$logger->log("Entering");
try {
$xmlrpc_server = xmlrpc_server_create();
$aliases = array();
$this->addIntrospectionData($xmlrpc_server, $service_description, $aliases);
$describeMethods = <<<END
<?xml version="1.0" ?>
<methodCall>
<methodName>system.describeMethods</methodName>
<params/>
</methodCall>
END;
$desc = xmlrpc_server_call_method($xmlrpc_server, $describeMethods, null);
xmlrpc_server_destroy($xmlrpc_server);
header('Content-type: text/xml');
echo $desc;
} catch (Exception $se) {
echo $se->exceptionString() . "\n";
}
}
开发者ID:psagi,项目名称:sdo,代码行数:29,代码来源:ServiceDescriptionGenerator.php
示例8: xmlrpc_server_create
///////////////////////////////////////////////////////////////////////////////
// XML-RPC Server
$xmlrpc_server = xmlrpc_server_create();
xmlrpc_server_register_method($xmlrpc_server, "login_to_simulator", "process_login");
// Read the request
$request_xml = file_get_contents("php://input");
// Check for a login capability
$authUserID = NULL;
if (!empty($_GET['cap'])) {
$authUserID = get_capability($_GET['cap']);
}
// Build the response
$response = xmlrpc_server_call_method($xmlrpc_server, $request_xml, $authUserID);
header('Content-Type: text/xml');
echo $response;
xmlrpc_server_destroy($xmlrpc_server);
exit;
///////////////////////////////////////////////////////////////////////////////
function make_seed()
{
list($usec, $sec) = explode(' ', microtime());
return (double) $sec + (double) $usec * 100000;
}
function inform_scene_of_logout($sceneID, $userID)
{
if ($sceneID == UUID::Zero) {
return;
}
$scene = lookup_scene_by_id($sceneID);
if (isset($scene)) {
// FIXME: Implement this
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:31,代码来源:index.php
示例9: xmlrpc_error
function xmlrpc_error($error_number, $error_string)
{
$r = CreateObject('phpgwapi.xmlrpcresp', '', $error_number, $error_string . ': ' . $this->last_method);
$this->service($r);
xmlrpc_server_destroy($GLOBALS['xmlrpc_server']);
exit;
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:7,代码来源:class.xmlrpc_server_epi.inc.php
示例10: XML_RPC_Server
$server = new XML_RPC_Server(array('validatePDF_callback' => array('function' => 'pear_validatePDF_callback')), 1);
return;
// execution end here
}
if ($xmlrpc['internal']) {
// use internal xml-rpc implementation (>php-4.1.0 experimental)
// create server
unset($GLOBALS['HTTP_RAW_POST_DATA']);
// save memory
$xmlrpc_server = xmlrpc_server_create();
if ($xmlrpc_server) {
xmlrpc_server_register_method($xmlrpc_server, "validatePDF_callback", "internal_validatePDF_callback");
$response = '';
echo xmlrpc_server_call_method($xmlrpc_server, $request_xml, $response, array('output_type' => "xml", 'version' => "auto"));
// free server resources
$success = xmlrpc_server_destroy($xmlrpc_server);
}
return;
// execution end here
}
// no useable xml-rpc impl. found
echo 'no useable xml-rpc impl. found';
informAdmin("no useable xml-rpc impl. found");
}
// function for XML_RPC implementation
function pear_validatePDF_callback($params)
{
$param = $params->getParam(0);
$file_data = $param->scalarval();
// binary
$param = $params->getParam(1);
开发者ID:alexzita,项目名称:alex_blog,代码行数:31,代码来源:validatePDF_callback.php
示例11: __destruct
public function __destruct()
{
xmlrpc_server_destroy($this->server);
}
开发者ID:robbiet480,项目名称:MineAdmin,代码行数:4,代码来源:prettyxmlrpc.php
示例12: mnet_server_invoke_method
/**
* Initialize the object (if necessary), execute the method or function, and
* return the response
*
* @param string $includefile The file that contains the object definition
* @param string $methodname The name of the method to execute
* @param string $method The full path to the method
* @param string $payload The XML-RPC request payload
* @param string $class The name of the class to instantiate (or false)
* @return string The XML-RPC response
*/
function mnet_server_invoke_method($includefile, $methodname, $method, $payload, $class = false)
{
$permission = mnet_permit_rpc_call($includefile, $methodname, $class);
if (RPC_NOSUCHFILE == $permission) {
// Generate error response - unable to locate function
exit(mnet_server_fault(705, 'nosuchfile', $includefile));
}
if (RPC_NOSUCHFUNCTION == $permission) {
// Generate error response - unable to locate function
exit(mnet_server_fault(706, 'nosuchfunction'));
}
if (RPC_FORBIDDENFUNCTION == $permission) {
// Generate error response - unable to locate function
exit(mnet_server_fault(707, 'forbidden-function'));
}
if (RPC_NOSUCHCLASS == $permission) {
// Generate error response - unable to locate function
exit(mnet_server_fault(7013, 'nosuchfunction'));
}
if (RPC_NOSUCHMETHOD == $permission) {
// Generate error response - unable to locate function
exit(mnet_server_fault(7014, 'nosuchmethod'));
}
if (RPC_NOSUCHFUNCTION == $permission) {
// Generate error response - unable to locate function
exit(mnet_server_fault(7014, 'nosuchmethod'));
}
if (RPC_FORBIDDENMETHOD == $permission) {
// Generate error response - unable to locate function
exit(mnet_server_fault(7015, 'nosuchfunction'));
}
if (0 < $permission) {
// Generate error response - unable to locate function
exit(mnet_server_fault(7019, 'unknownerror'));
}
if (RPC_OK == $permission) {
$xmlrpcserver = xmlrpc_server_create();
$bool = xmlrpc_server_register_method($xmlrpcserver, $method, 'mnet_server_dummy_method');
$response = xmlrpc_server_call_method($xmlrpcserver, $payload, $methodname, array("encoding" => "utf-8"));
$bool = xmlrpc_server_destroy($xmlrpcserver);
return $response;
}
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:54,代码来源:server.php
示例13: xmlrpc_error
/**
* Create an XML-RPC error
*
* @param integer $error_number
* @param string $error_string
* @todo FIXME! This needs to be expanded to handle PHP errors themselfs it will make debugging easier
*/
function xmlrpc_error($error_number, $error_string)
{
$values = array('faultString' => $error_string, 'faultCode' => $error_number);
echo xmlrpc_encode_request(NULL, $values, array("encoding" => "utf-8"));
xmlrpc_server_destroy($GLOBALS['xmlrpc_server']);
exit;
}
开发者ID:HaakonME,项目名称:porticoestate,代码行数:14,代码来源:xmlrpc.php
示例14: __destruct
public function __destruct()
{
xmlrpc_server_destroy($this->getHandle());
}
开发者ID:blar,项目名称:xmlrpc,代码行数:4,代码来源:XmlrpcServer.php
示例15: local
<?php
/*
Функция-обработчик получаемых данных. $method_name – имя вызываемого метода, $params - параметры, $user_data – пользовательские данные. Подробнее – в документации к PHP.
*/
function local($method_name, $params, $user_data)
{
/*возвращаем сериализованные входящие данные*/
return serialize($params);
}
/*создаем сервер*/
$s = xmlrpc_server_create();
/*регистрируем метод-обработчик*/
xmlrpc_server_register_method($s, 'external', 'local');
/*вызываем обработчик, передаем ему входящие данные, если обработчик возвращает что-то – выводим это на экран*/
if ($data = xmlrpc_server_call_method($s, $HTTP_RAW_POST_DATA, null)) {
echo $data;
}
/*уничтожаем сервер*/
xmlrpc_server_destroy($s);
开发者ID:aldegtyarev,项目名称:vip-kvartira,代码行数:20,代码来源:server.php
示例16: mnet_server_invoke_dangerous_method
/**
* Initialize the object (if necessary), execute the method or function, and
* return the response
*
* @param string $includefile The file that contains the object definition
* @param string $methodname The name of the method to execute
* @param string $method The full path to the method
* @param string $payload The XML-RPC request payload
* @param string $class The name of the class to instantiate (or false)
*
* @throws mnet_server_exception
*
* @return string The XML-RPC response
*/
function mnet_server_invoke_dangerous_method($includefile, $methodname, $method, $payload) {
if (file_exists($CFG->dirroot . $includefile)) {
require_once $CFG->dirroot . $includefile;
// $callprefix matches the rpc convention
// of not having a leading slash
$callprefix = preg_replace('!^/!', '', $includefile);
} else {
throw new mnet_server_exception(705, "nosuchfile");
}
if ($functionname != clean_param($functionname, PARAM_PATH)) {
throw new mnet_server_exception(7012, "nosuchfunction");
}
if (!function_exists($functionname)) {
throw new mnet_server_exception(7012, "nosuchfunction");
}
$xmlrpcserver = xmlrpc_server_create();
xmlrpc_server_register_method($xmlrpcserver, $method, 'mnet_server_dummy_method');
$response = xmlrpc_server_call_method($xmlrpcserver, $payload, $methodname, array("encoding" => "utf-8"));
xmlrpc_server_destroy($xmlrpcserver);
return $response;
}
开发者ID:JP-Git,项目名称:moodle,代码行数:38,代码来源:serverlib.php
示例17: xmlrpcgetaffiliations
function xmlrpcgetaffiliations()
{
global $xmlrpc_handle, $HTTP_RAW_POST_DATA;
# create xmlrpc handle
$xmlrpc_handle = xmlrpc_server_create();
# register functions available via rpc calls
xmlrpc_server_register_method($xmlrpc_handle, "XMLRPCaffiliations", "xmlRPChandler");
print xmlrpc_server_call_method($xmlrpc_handle, $HTTP_RAW_POST_DATA, '');
xmlrpc_server_destroy($xmlrpc_handle);
semUnlock();
dbDisconnect();
exit;
}
开发者ID:gw-acadtech,项目名称:VCL,代码行数:13,代码来源:utils.php
示例18: __destruct
/**
* Destructor
*/
public function __destruct()
{
if (self::$refcnt && !--self::$refcnt) {
xmlrpc_server_destroy(self::$xmlrpc);
}
}
开发者ID:nickl-,项目名称:pecl-http,代码行数:9,代码来源:XmlRpcServer.php
示例19: handleRequest
/**
* Méthoode qui gère les requêtes effectuées par les clients xmlrpc.
*
* @access public
* @return void
*/
public function handleRequest()
{
// récupère le xml envoyé par le client
$params = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents('php://input');
// output_options
// http://xmlrpc-epi.sourceforge.net/main.php?t=php_api#output_options
$output_options = array('encoding' => $this->encoding, 'verbosity' => 'no_white_space');
// sette la locale
if (isset($_SESSION['locale'])) {
I18N::setLocale($_SESSION['locale']);
}
// appelle la méthode
$response = xmlrpc_server_call_method($this->_server, $params, null, $output_options);
header('Content-Type: text/xml');
header('Content-Length: ' . strlen($response));
echo $response;
// nettoyage
xmlrpc_server_destroy($this->_server);
}
开发者ID:arhe,项目名称:pwak,代码行数:25,代码来源:Server.php
示例20: processRequest
function processRequest(&$request_xml)
{
// define XML-RPC server
$server = xmlrpc_server_create();
// log for debuggin
$fp = fopen("/var/tmp/ws_request.log", "a");
fwrite($fp, date("H:i") . "\n");
fwrite($fp, $request_xml);
fwrite($fp, "\n\n");
fclose($fp);
// register methods
xmlrpc_server_register_method($server, "getQueueValues", "rpc_get_queue_values");
xmlrpc_server_register_method($server, "pushValue", "rpc_push_value");
xmlrpc_server_register_method($server, "getStateData", "rpc_get_state_data");
xmlrpc_server_register_method($server, "setStateData", "rpc_set_state_data");
xmlrpc_server_register_method($server, "helloWorld", "rpc_hello_world");
xmlrpc_server_register_method($server, "noop", "rpc_hello_world");
// call the method
$response =& xmlrpc_server_call_method($server, $request_xml, '');
// send back the respond
print $response;
// release resources
xmlrpc_server_destroy($server);
}
开发者ID:andrewhuang,项目名称:webscheme,代码行数:24,代码来源:xmlrpc.php
注:本文中的xmlrpc_server_destroy函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论