Subscribe Today

Guardian Updates


Receive HTML?

Guardian News

Free Themes

Location

PDF Print E-mail

WordPressXmlRpc is a PHP library for sending commands to a WordPress blog to perform various functions. Currently, the only function in the library is for posting a message to a blog. The title of the post, category, and status (active or draft) can be set.

The following is an example how to use the library.

include 'WordPressXmlRpc/class.WordPressXmlRpc.php';

// Login to blog. The URL should not include the http
// part (see $sUrl).

$sUrl = 'www.yourblog.com';
$sUsername = 'admin';
$sPassword = 'password';

$wp = new WordPressXmlRpc ($sUrl, $sUsername, $sPassword);

// Post message to blog.

$sTitle = 'Test';
$sCategory = 'General';
$sMessage = 'This is a test.';
$bPublish = false;

$bSuccess = $wp->PostMessage ($sTitle, $sCategory, $sMessage,
$bPublish);

if ($bSuccess)
echo '<p>Message successfully posted.</p>';
else
echo '<p>Message was not posted.</p>';

Requirements

This library was originally written for PHP 5, but due to the many PHP 4 users who wanted to use it, we created a version just for them. The class usage is the same for both PHP versions, so when the PHP 4 users upgrade to version 5, their applications will still function the same when upgrading the class library. Of course, the PHP 4 version will also work in PHP 5.

Download

WordPressXmlRpc_for_PHP5_1.0.1.zip for PHP 5 users

WordPressXmlRpc_for_PHP4_1.0.1.zip for PHP 4 or higher users