Top Poster
#1 ramon fincken 399
#2 Site admin 3
#3 Ber|Art 2
#4 braddmark 1
#5 accentmedia 1
#6 Xarzu 1
#7 pEcosespedex 1
#8 khadish 1
#9 moxxx 1
#10 nistelrock 1
[solution][snipplet] Setting up a xmlrpc server ( pingback response )



Rating : 3 / 5

 
Post new topic   Reply to topic    Ramonfincken.com Forum Index -> PHP coding
Beta
Want to be notified by email when this topic gets a reply?  
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: 399
Location: A'dam/Diemen, The Netherlands

PostPosted: Sat Jan 31, 2009 6:55 pm    Post subject: [solution][snipplet] Setting up a xmlrpc server ( pingback response ) Reply with quote

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 Smile

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
View user's profile Send private message Visit poster's website
Google adsense
Advertisement





PostPosted: Sat Jan 31, 2009 6:55 pm    Post subject: [solution][snipplet] Setting up a xmlrpc server ( pingback response )

Advertisement
Back to top
GravityForms
Advertisement





PostPosted: Sat Jan 31, 2009 6:55 pm    Post subject: [solution][snipplet] Setting up a xmlrpc server ( pingback response )

Advertisement
Gravity Forms Plugin for WordPress
Back to top
Post new topic   Reply to topic    Ramonfincken.com Forum Index -> PHP coding All times are GMT
Page 1 of 1

 
Jump to:  
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
General forums
The world of freelance
Programming
Other projects
Poll
I love gifts

Yes goodies and presents! [3]
No but I love polls ! [1]

Related google ads