Example #1
0
function make_request($request_xml, &$output)
{
    $retval = call_socket('php.loc', 80, '/test/xml-rpc/xml-rpc-server.php', $request_xml);
    /*НАЧАЛО ЗАПРОСА*/
    /*$opts = array('http'=>array('method'=>"POST",'header'=>"User-Agent: PHPRPC/1.0\r\n"."Content-Type: text/xml\r\n"."Content-Length: ".strlen($request_xml)."\r\n",'content'=>"$request_xml"));
    		$context = stream_context_create($opts);
    		$retval = file_get_contents('http://php.loc/test/xml-rpc/xml-rpc-server.php');
    		/*КОНЕЦ ЗАПРОСА*/
    $data = xmlrpc_decode($retval);
    if (is_array($data) && xmlrpc_is_fault($data)) {
        $output = $data;
    } else {
        $output = unserialize(base64_decode($data));
    }
}
Example #2
0
function make_request($request_xml, &$output)
{
    $retval = call_socket('k3', 80, '/xml-rpc/xml-rpc-server.php', $request_xml);
    //$retval = call_socket('omnimir.ru', 80, '/', $request_xml);
    /*
    $opts = array(
    'http'=>array(
    'method'=>"POST",
    'header'=>"User-Agent: PHPRPC/1.0\r\n" .
    "Content-Type: text/xml\r\n" .
    "Content-length: " . strlen($request_xml) . "\r\n",
    'content'=>"$request_xml"
    )
    );
    $context = stream_context_create($opts);
    $retval = file_get_contents('http://k3/xml-rpc/xml-rpc-server.php', false, $context);
    */
    $data = xmlrpc_decode($retval);
    if (is_array($data) && xmlrpc_is_fault($data)) {
        $output = $data;
    } else {
        $output = unserialize(base64_decode($data));
    }
}