[Opensim-dev] (XML-RPC) HTTP/1.0 400 BadRequest: Invalid request line

Jeff Kelley opensim at pescadoo.net
Wed Oct 22 22:48:17 UTC 2014


Dear developers.

I use XML-HTTP with success, except a HTTP 400 error is appended to 
the (otherwise correct) XML response. Example:

llRemoteDataReply(channel, message_id, "Je vous ai compris", 42);

My PHP program reads:

<?xml version="1.0" 
encoding="utf-8"?><methodResponse><params><param><value><array><data><value><struct><member><name>IntValue</name><value><i4>42</i4></value></member><member><name>StringValue</name><value><string>Je 
vous ai 
compris</string></value></member></struct></value></data></array></value></param></params></methodResponse>HTTP/1.0 
400 BadRequest: Invalid request line.

I can strip the extra data and go as-is, but I would prefer to 
understand what triggers "Invalid request line" to fix my code.

Can you help?

-- Jeff



Full PHP code:


<?php
$req_url = 'http://192.168.0.6:20800/';

$request = xmlrpc_encode_request('llRemoteData',
	array ('Channel' => '71c0838f-fb8c-4c5d-a500-9dae4298243d',
		'IntValue' => 117,
		'StringValue' => 'GABUZO')
);

$context = stream_context_create(array('http' => array(
	'method' => "POST",
	'header'=> "Content-type: text/xml\r\n"
		"Content-length: ".strlen($request)."\r\n",
	'content' => $request
    )));

$file = file_get_contents($req_url, false, $context);

$lastbracket =  strrpos($file, '>');
$extra = substr ($file, $lastbracket+1,-1);
$file  = substr ($file, 0, $lastbracket+1);

$answer = xmlrpc_decode($file);

print_r ($answer);
?>

Array
(
     [0] => Array
         (
             [IntValue] => 42
             [StringValue] => Je vous ai compris
         )

)


More information about the Opensim-dev mailing list