2

I'm trying to create a pingback script for our website, however 1&1 does not have the XMLRPC extension that we require installed.

Are there any alternatives to creating a pingback/trackback script without the need of this extension - and are there any demos?

asked Jul 17, 2012 at 15:15

2 Answers 2

2

phpxmlrpc

An old Php implementation and it seem to be abandoned, but you can see how to use it to send pingbacks or receive them in this blogpost.

Zend

There is a pure php implementation of XML-RPC client and server in the Zend framework, you can use it to call or implement a pingback service, and it's well documented. If you don't want to use the full framework only as a component library, just download the framework, extract the lib/Zend from it to a directory and include the component's top level file. (you might want to set up autoloading for convenience)

The pingback service description is here.

If you have that set up, you can go to this blogpost for pointers for client/server codes, i give you some examples with the Zend classes (the post uses the xmlrpc extension)

Sending pingbacks:

require_once 'Zend/XmlRpc/Client.php'; // path to the framework files
try {
 $client = new Zend_XmlRpc_Client('<pingback service url>');
 $client->call('pingback.ping', array('<source uri>', '<target uri>'));
} catch (Exception $e) {
 // error handling
}

The service url will be in the blog post's http header, or in a meta tag, described in the pingback documentation.

Pingback service skeleton

class PingBackService {
 public function ping($source, $target) {
 $source_url = $source[0];
 $target_url = $target[0];
 // validate parameters here, see http://www.quietearth.us/articles/2006/10/30/Coding-your-own-blog-Pingback-in-php for pointers
 return 'Pingback registered. May the force be with you';
 }
}
require_once 'Zend/XmlRpc/Server.php';
try {
 $server = new Zend_XmlRpc_Server();
 $server->setClass('PingBackService', 'pingback');
 echo $server->handle();
} catch (Exception $e) {
 // handle errors
}
answered Jul 17, 2012 at 16:24
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, I didn't know I could just pull bits out of Zend. Sweet!
0

PEAR has the XML_RPC2 package which implements an XML-RPC client and server in PHP userland without any needing a special extension.

answered Sep 30, 2013 at 6:23

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.