Thanks to the excellent help from someone at Full Data Systems (Thank you!),
I finally managed to get the XmlRPC extension working on my windows PHP
installation.

I am not trying to send any params at the moment, all I want to do is get a
valid response.

However, now when I try and run the script in debug mode, I get an error
message (Details below).

The same script works fine on a Mac OSX Server machine that we have. Anyone
have any idea's?

opening socket to host: localhost, port: 80, uri:
Test_Server/XML/PHP_Servers/XMLTEST.php

sending http request:

POST Test_Server/XML/PHP_Servers/XMLTEST.php HTTP/1.0
User-Agent: xmlrpc-epi-php/0.2 (PHP)
Host: localhost:80
Content-Type: text/xml
Content-Length: 111

<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>test</methodName>
<params/>
</methodCall>

receiving response...

got response:

. 

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr />
<address>Apache/2.0.47 (Win32) PHP/4.3.2 Server at localhost Port
80</address>
</body></html>





//-------[ Here is the client code: -------\\

<?PHP

require_once('XMLRPC_Utils.php');

$XMLRequest = array();

$options = array('output type' => 'xml', 'version' => 'xmlrpc');
$result = xu_rpc_http_concise(
        array(method    => 'test',
                  args  => $XMLRequest,
                  host  => 'localhost',
                  uri           =>
'Test_Server/XML/PHP_Servers/XMLTEST.php',
                  port  => 80,
                  options       => $options,
                  debug => 1));

?>

//-------[ Here is the server code: -------\\

<?php

include("xmlrpc_utils.php");

// ensure extension is loaded.
xu_load_extension();

function test($method_name, $params, $app_data)
        {
                return 'Hello Scott';
        }

        /* create a new server object */
        $server = xmlrpc_server_create();
        
        xmlrpc_server_register_method($server, "test", "test");
        
        /* Now, let's get the client's request from the post data.... */
        $request_xml = $HTTP_RAW_POST_DATA;
        if(!$request_xml) {
          $request_xml = $HTTP_GET_VARS[xml];
        }
        if(!$request_xml) {
          echo "<h1>No XML input found!</h1>";
        }
        else {
          /* setup some (optional) output options */
          $display = array();
          if($HTTP_POST_VARS[verbosity]) {
                 $display[verbosity] = $HTTP_POST_VARS[verbosity];
          }
          if($HTTP_POST_VARS[escaping]) {
                 $display[escaping] = $HTTP_POST_VARS[escaping];
          }
          else {
                 $display[escaping] = array("non-ascii", "markup");
          }
          if($HTTP_POST_VARS[version]) {
                 $display[version] = $HTTP_POST_VARS[version];
          }
          if($HTTP_POST_VARS[encoding]) {
                 $display[encoding] = $HTTP_POST_VARS[encoding];
          }
          if($HTTP_POST_VARS[output_type]) {
                 $display[output_type] = $HTTP_POST_VARS[output_type];
          }
        
          /* handle the request */
          $response = xmlrpc_server_call_method($server, $request_xml,
$response, $display);
        
          if($HTTP_POST_VARS[disp] === "html") {
                 if($HTTP_POST_VARS[output_type] === "php") {
                        echo "<xmp>\n";
                        var_dump($response);
                        echo "\n</xmp>\n";
                 }
                 else {
                        echo "<xmp>\n$response\n</xmp>\n";
                 }
          }
          else {
                 echo "$response";
          }
        }
        
?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to