All content and services are licenced under a Attribution-NonCommercial-ShareAlike Creative Commons Licence (see our Terms of Service).
> Using the XML-RPC Server
|
XML-RPC is "a spec and a set of implementations that allow software running on disparate operating systems, running in different environments to make procedure calls over the Internet. It's remote procedure calling using HTTP as the transport and XML as the encoding. XML-RPC is designed to be as simple as possible, while allowing complex data structures to be transmitted, processed and returned."
To use this service, you need to:
| |
| Host | www.newsisfree.com |
|---|---|
| Port | 80 |
| Path | /RPC |
|
This RPC interface is part Premium Export Service (if you've just opened an account, it's available freely for the first 30 days, it will be disable if you don't sign up before). By using it, you aggree to comply with the Terms of Service. | |
> Search for sources
This method searchs the database for news sources with name or description
containing a substring:
This method returns an array with all the found sources. Each entry is itself
an array which contains 3 named elements: "name": the name of source;
"id": the ID, which can be used to get the content of the source;
"info": an URL to a page on this site describing the source.
- First two parameters are your user id and password respectively;
- Second parameter is the string to look for;
<?
/*
HPE - News Portal Engine
Copyright (C) 2000-2003 Mike Krus
This program is free software; it is distributed in the hope
that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
READ LICENSE.TXT IN THE BASE DIRECTORY FOR INFORMATION
ABOUT REDISTRIBUTING THIS SOURCE CODE
*/
$c = new xmlrpc_client("/RPC", "www.newsisfree.com", 80);
$f = new xmlrpcmsg('hpe.searchSources',
array(
new xmlrpcval($login),
new xmlrpcval(md5($password)),
new xmlrpcval("CNN"),
new xmlrpcval("en"),
new xmlrpcval(31, 'int')
)
);
echo "<P>Sending Request:<br/>\n<pre>" . htmlentities($f->serialize()) . "</pre></p>\n";
$r = $c->send($f);
$v = $r->value();
if (!$r->faultCode())
{
$data = xmlrpc_decode($v);
$n = count($data);
print "Found " . count($data) . " source(s) matching string 'BBC'";
if($n)
{
print("<UL>");
for($i=0; $i<$n; $i++)
print("<LI> <A HREF=" . $data[$i]["info"] . ">" . $data[$i]["name"] . "</A>");
print("</UL>");
}
}
else
{
print "Error Code: " . $r->faultCode() . " Reason '" .$r->faultString()."'<BR>";
}
?>
