|
|
View previous topic
::
View next topic
|
Author |
Message |
ramon fincken Site's programmer
 Get a free globally recognized avatar It's free!
Joined: 03 Aug 2007 Posts: 402 Location: A'dam/Diemen, The Netherlands
|
Posted: Sat Jan 31, 2009 6:55 pm Post subject: [solution][snipplet] Setting up a xmlrpc server ( pingback response ) |
|
|
In addition to:
http://www.ramonfincken.com/120/PHP+cod...te+...html
I needed a pingbackserver to run over here, and after weeks of searching and trying ... I came across :
http://www.quietearth.us/articles/2006/...ack-in-php
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 !!
Read on:
http://www.hixie.ch/specs/pingback/pingback
Pingback server skeleton:
For a full script read on over here:
http://www.quietearth.us/articles/2006/...ack-in-php
Code: |
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(); |
|
|
Back to top |
|
 |
Google adsense Advertisement
|
Posted: Sat Jan 31, 2009 6:55 pm Post subject: [solution][snipplet] Setting up a xmlrpc server ( pingback response ) |
|
|
Advertisement
|
|
Back to top |
|
 |
GravityForms Advertisement
|
Posted: Sat Jan 31, 2009 6:55 pm Post subject: [solution][snipplet] Setting up a xmlrpc server ( pingback response ) |
|
|
Advertisement
 |
|
Back to top |
|
 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|