Jump to content

XML-RPC troubles...


Neptunus Maris

Recommended Posts

Hi guys I'm new to XML-RPC and I'm having trouble trying to get XML-RPC to recognize my methods.

 

Here is my function 'method':

<?php
function get_user_status($method_name, $params, $app_data) {
global $db, $users;

//output for return
$op = '';

$op .= '<table border = "0">';
if (sizeof($params[0]) > 0) {
	foreach ($params[0] as $user) {
		$op .= '<tr>
					<td>'.$user.'\'s status:<br />';


		$sql = "SELECT
		s.*
		FROM status s
		LEFT JOIN users u
		ON s.user = '".$users->id_by_username($user)."'
		ORDER BY post_date DESC LIMIT ".$params[1];

		$db->exe_sql($sql);

		$op .= '<table border = "0">';
		while ($row = $db->fetch_array()) {
			$op .= '<tr>
				<td><small>'.date('M d Y h:i a', $row['post_date']).'</small><br />
					'.nl2br(stripslashes(htmlspecialchars_decode($row['status']))).'</td>
			</tr>';
		}
		$op .= '</table>';


		$op .= '</td>
			</tr>';
	}
} else {
	$op .= '<tr><td>You have no friends listed in this tracker.</td></tr>';
}
$op .= '</table>';

return $op;
}
?>

 

And here is what I'm doing with XML-RPC in the same script:

<?php
$xmlrpc_server = xmlrpc_server_create();
xmlrpc_server_register_method($xmlrpc_server, 'get_status', 'get_user_status');
$request_xml = $HTTP_RAW_POST_DATA;
$response = xmlrpc_server_call_method($xmlrpc_server, $request_xml, '');
header('Content-type: text/xml');
print $response;
xmlrpc_server_destroy($xmlrpc_server);
?>

 

I get these errors from an XML output:

<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultString</name>
<value>
<string>server error. method not found.</string>
</value>
</member>
<member>
<name>faultCode</name>
<value>
<int>-32601</int>
</value>
</member>
</struct>
</value>
</fault>
</methodResponse>

 

I have no idea what I'm doing..I spent a whole day on Google, but found no quick and simple solutions.

 

Thanks guys..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.