[solution][snipplet] Setting up a xmlrpc server ( pingback response )


min read

My profile

Share this:

In addition to:

I needed a pingbackserver to run over here, and after weeks of searching and trying … I came across :

This url has a “framework” to set up your own pingback server, of course when you are in need of that very code you have the experience to code the rest 🙂

Thanks quietearth !!

[b:61f71d8384]Read on:[/b:61f71d8384]

[b:61f71d8384]Pingback server skeleton:[/b:61f71d8384]
For a full script read on over here:

header(“Content-Type: application/xml”);

function pbprocess($m) {
global $xmlrpcerruser;

$x1 = $m->getParam(0);
$x2 = $m->getParam(1);
$source = $x1->scalarval(); # their article
$dest = $x2->scalarval(); # your article

# here we can check for valid urls in source and dest, security
# lookup the dest article in our database etc..

if (..) { # source uri does not exist
return new xmlrpcresp(0, 16, “Source uri does not exist”);

if (..) { # source uri does not have a link to target uri
return new xmlrpcresp(0, 17, “Source uri does have link to target uri”);

if (..) { # target uri does not exist
return new xmlrpcresp(0, 32, “Target uri does not exist”);

if (..) { # target uri cannot be used as target
return new xmlrpcresp(0, 33, “Target uri cannot be used as target”);

if (..) { # Pingback already registered
return new xmlrpcresp(0, 48, “Target uri cannot be used as target”);

if (..) { # Access denied
return new xmlrpcresp(0, 49, “Access denied”);

if (..) { # Could not communicate with upstream server or got error
return new xmlrpcresp(0, 50, “Problem with upstream server”);

if (..) { # Generic fault code if not applicable to above
return new xmlrpcresp(0, 50, “Unkown error”);

return new xmlrpcresp(new xmlrpcval(“Pingback registered. May the force be with you.”, “string”));

$a = array( “pingback.ping” => array( “function” => “pbprocess” ));

$s = new xmlrpc_server($a, false);

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *