[phpxmlrpc] A newbie needs hand holding implementing Newsisfree web services

guardemail04-phpxml at yahoo.com guardemail04-phpxml at yahoo.com
Sun Feb 4 20:36:39 UTC 2007

I'm a newbie who doesn't know anything about php coding or xml-rpc, but trying
to implement news syndication on my site using Newsisfree, using XMLRPC-2.1. 
I'm completely lost regarding the "Incorrect parameters passed to method:
Wanted , got  at param" error message I've been getting.

First, some background information:

I want to seach Newsisfree and compile a list of news items relating to the
search word or phrase in xml format, then for my visitors to subscribe to it.  

Here are some of the specifications from Newisfree:

Configure your XML-RPC client using the information below. All methods on the
server require that you give your user login and password (MD5 encoded) as
strings in the first two parameters. 
At this time, there are three methods configured on the server (see samples
hpe.getSource : retrieve the meta data AND list of news items for a given
source. To find an ID for a source, use the source browsing page. 
hpe.getSourceInfo : retrieve the meta data for a given source. 
hpe.getSourceItems : retrieve the list of news items for a given source. 
hpe.getSources : retrieve the list of news items for a several sources. 
hpe.searchSources : search for sources which contain a string in their name. 
hpe.createUser : creates a new user. 

And the code I'm using so far is:


  $c=new xmlrpc_client("/RPC", "www.newsisfree.com", 80);
  $c->setCredentials("username removed", "password removed");
  $f=new xmlrpcmsg('hpe.getSource', array('search term removed'));
  if (!$r->faultCode()) {
    print "I received:" . htmlspecialchars($v->scalarval()) . "<br/>";
    print "<hr/>I got this value back<br/>pre>" .
      htmlentities($r->serialize()). "</pre>\n";
  } else {
    print "An error occurred: ";
    print "Code: " . htmlspecialchars($r->faultCode()) .
      " Reason: '" . ($r->faultString()) . "'<br/>";
/*** client side ***/
// $c = new xmlrpc_client('http://www.newsisfree.com/RPC');

// tell the client to return raw xml as response value
$c->return_type = 'xml';

if ($r->faultCode())
  // HTTP transport error
  echo 'Got error '.$r->faultCode();
  // HTTP request OK, but XML returned from server not parsed yet
  $v = xmlrpc_decode($r->value());
  // check if we got a valid xmlrpc response from server
  if ($v === NULL)
    echo 'Got invalid response';
  // check if server sent a fault response
  if (xmlrpc_is_fault($v))
    echo 'Got xmlrpc fault '.$v['faultCode'];
    echo'Got response: '.htmlentities($v);

Here is what is happening:

User-Agent: XML-RPC for PHP 2.1
Host: www.newsisfree.com:80
Authorization: Basic removed 
Accept-Encoding: gzip, deflate
Accept-Charset: UTF-8,ISO-8859-1,US-ASCII
Content-Type: text/xml
Content-Length: 106

<?xml version="1.0"?>

HTTP/1.1 200 OK
Date: Sun, 04 Feb 2007 19:42:07 GMT
Server: Apache/1.3.33 (Unix) mod_gzip/ PHP/4.3.9 mod_ssl/2.8.22
X-Powered-By: PHP/4.3.9
Connection: close
Content-Type: text/xml
Content-length: 388

<?xml version="1.0" ?>
        <value><string>Incorrect parameters passed to method: Wanted , got  at
param )</string></value>

HEADER: date: Sun, 04 Feb 2007 19:42:07 GMT
HEADER: server: Apache/1.3.33 (Unix) mod_gzip/ PHP/4.3.9
mod_ssl/2.8.22 OpenSSL/0.9.7e
HEADER: x-powered-by: PHP/4.3.9
HEADER: connection: close
HEADER: content-type: text/xml
HEADER: content-length: 388

class xmlrpcval {
  var $me = 
  array (
    'struct' => 
    array (
      'faultCode' => 
      class xmlrpcval {
        var $me = 
        array (
          'int' => 3,
        var $mytype = 1;
        var $_php_class = NULL;
      'faultString' => 
      class xmlrpcval {
        var $me = 
        array (
          'string' => 'Incorrect parameters passed to method: Wanted , got  at
param )',
        var $mytype = 1;
        var $_php_class = NULL;
  var $mytype = 3;
  var $_php_class = NULL;
An error occurred: Code: 3 Reason: 'Incorrect parameters passed to method:
Wanted , got at param )'
Got error 3 

I know this is a lengthy email, but I wanted to answer as much question upfront
as possible.  I hope someone here can help me get this thing implemented. 

Thank you.

More information about the phpxmlrpc mailing list