In addition to:
[url]http://www.ramonfincken.com/120/PHP+coding/Finding+the+x-pingback++xmlrpc++url+from+any+website+…html[/url]
I needed a pingbackserver to run over here, and after weeks of searching and trying … I came across :
[url]http://www.quietearth.us/articles/2006/10/30/Coding-your-own-blog-Pingback-in-php[/url]
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]
http://www.hixie.ch/specs/pingback/pingback
[b:61f71d8384]Pingback server skeleton:[/b:61f71d8384]
For a full script read on over here:
[url]http://www.quietearth.us/articles/2006/10/30/Coding-your-own-blog-Pingback-in-php[/url]
[code:1:61f71d8384]
header(“Content-Type: application/xml”);
require_once(’/path/to/xmlrpc/lib/xmlrpc.inc’);
require_once(’/path/to/xmlrpc/lib/xmlrpcs.inc’);
function pbprocess($m) {
global $xmlrpcerruser;
$x1 = $m->getParam(0);
$x2 = $m->getParam(1);
$source = $x1->scalarval(); # their article
$dest = $x2->scalarval(); # your article
# INSERT CODE
# 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);
#$s->setdebug(3);
$s->service();[/code:1:61f71d8384]
Leave a Reply