⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test-service.php

📁 这个包主要用来帮助我们了解carrot2的格式
💻 PHP
📖 第 1 页 / 共 5 页
字号:
<?php

require_once("carrot2.inc");

//
// A test script to validate a remote Carrot2 XML RPC service
// and to check character encoding incompatibilities.
// 

//
// This page is encoded in this encoding.
//
$THISPAGE_ENCODING = "UTF-8";

//
// Force UTF-8 as the transport encoding.
//
$GLOBALS['xmlrpc_defencoding'] = 'UTF-8';
$GLOBALS['xmlrpc_internalencoding'] = 'UTF-8';

//
// Make an object to represent our server.
//
$server = new xmlrpc_client($SERVICE, $SERVER, $PORT);

//
// Start writing test response. This page is encoded in iso-8859-2
//
header("Content-type: text/html; charset=$THISPAGE_ENCODING");
?>
<html>
<head>
    <meta http-equiv="Content-type" content="text/html; charset=<?php echo $THISPAGE_ENCODING; ?>">
    <title>Carrot2 XML-RPC Test</title>
    <style type="text/css">
    body {
        margin: 10px;
        font-family: sans-serif;
        font-size: 11px;
        background-color: white;
        color: black;
    }
    p.head {
        font-weight: bold;
        margin-top: 15px;
    }
    p.value {
        margin-left: 15px;
        background-color: #e0e0e0;
        padding: 2px;
    }
    pre {
        margin-left: 15px;
        background-color: #f0f0f0;
        padding: 2px;
    }
    </style>
</head>
<body>

<?php

echo '<p class="head">Test URL:</p><p class="value">' . "$SERVER:$PORT ($SERVICE) </p>";

//
// Test: Check if the service works at all.
//

echo '<p class="head">Testing, simple ping:</p><p class="value">';

$message = new xmlrpcmsg('test-encoding.echoTrue', array());
$result = $server->send($message);
if (!$result) {
	echo "ERROR: No result (could not connect?).";
} elseif ($result->faultCode()) {
	echo "XML-RPC Fault #" . $result->faultCode() . ": " . $result->faultString();
} else {
	$value = $result->value();
	if ($value->scalarval() == true) {
        echo "PASSED";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -