title: Passing a parameter in the header (XML RPC)
body: <p>I'm trying to set up a server status for the MMORPG Champions Online. I got some basic information from the web master and this is all he told me:</p>
  
  <ul>
  <li>XML-RPC call to server: <a href="http://www.champions-online.com/xmlrpc.php" rel="nofollow noreferrer">http://www.champions-online.com/xmlrpc.php</a></li>
  <li>function name:  wgsLauncher.getServerStatus</li>
  <li>Parameter (language): en-US</li>
  </ul>
  
  <p>Now, I found a nice example to start with <a href="http://snippets.dzone.com/posts/show/2596" rel="nofollow noreferrer">here</a>, and I ended up with this code:</p>
  
  <pre><code>&lt;?php
   ini_set('display_errors', 1);
   error_reporting(E_ALL);
  
  # Using the XML-RPC extension to format the XML package
  $request = xmlrpc_encode_request("wgsLauncher.getServerStatus", "&lt;param&gt;&lt;value&gt;&lt;string&gt;en-US&lt;/string&gt;&lt;/value&gt;&lt;/param&gt;", null );
  
  # Using the cURL extension to send it off, 
  # first creating a custom header block
  $header[] = "Host: http://www.champions-online.com:80/";
  $header[] = "Content-type: text/xml";
  $header[] = "Content-length: ".strlen($request) . "\r\n";
  $header[] = $request;
  
  $ch = curl_init();
  curl_setopt( $ch, CURLOPT_URL, "http://www.champions-online.com/xmlrpc.php"); # URL to post to
  curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); # return into a variable
  curl_setopt( $ch, CURLOPT_HTTPHEADER, $header ); # custom headers, see above
  curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'POST' ); # This POST is special, and uses its specified Content-type
  $result = curl_exec( $ch ); # run!
  curl_close($ch); 
  
  echo $result;
  ?&gt;
  </code></pre>
  
  <p>But I'm getting a "400 Bad Request" error. I'm new to XML RPC and I barely know php, so I'm at a loss. The <a href="http://us3.php.net/manual/en/function.xmlrpc-encode-request.php" rel="nofollow noreferrer">examples</a> from the php site show how to use an array as a parameter, but nothing else. </p>
  
  <p>I obtained the parameter string <code>&lt;param&gt;&lt;value&gt;&lt;string&gt;en-US&lt;/string&gt;&lt;/value&gt;&lt;/param&gt;</code> from this <a href="http://gggeek.raprap.it/debugger/" rel="nofollow noreferrer">XMLRPC Debugger</a> (very nice btw). I entered the parameter I needed in the "payload" box and this was the output.</p>
  
  <p>So, I would appreciate any help on how to pass this parameter to the header.</p>
  
  <p>Note: My host supports <a href="http://phpinfo.byethost11.com/index.php" rel="nofollow noreferrer">xmlrpc</a> but it seems the function "xmlrpc_client" doesn't exist.</p>
  
  <hr>
  
  <p>Update: The web master replied with this information, but it's still not working... it's getting to the point I may just scrape the status off the page.</p>
  
  <pre><code>$request = xmlrpc_encode_request("wgsLauncher.getServerStatus", "en-US" );
  </code></pre>