Passing a parameter in the header (XML RPC) Passing a parameter in the header (XML RPC) curl curl

Passing a parameter in the header (XML RPC)


Ok, I finally figured out my answer... It seemed to be a problem in the header, because it worked when I changed the cURL code to match the code I found it on this site. The post is about how to remotely post to wordpress using XMLRPC in php.

This is the code I ended up with:

<?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", "en-US" );$ch = curl_init();curl_setopt($ch, CURLOPT_POSTFIELDS, $request);curl_setopt($ch, CURLOPT_URL, "http://www.champions-online.com/xmlrpc.php");curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_TIMEOUT, 1);$result = curl_exec($ch);curl_close($ch);$method = null;$params = xmlrpc_decode_request($result, &$method); # server status result = true (up) or false (down)$status = ($params['status']) ? 'up' : 'down';$notice = ($params['notice'] == "") ? "" : "Notice: " + $params['notice'];echo "Server Status: " . $status . "<br>";echo $notice;?>