topical media & game development
mashup-delicious-08-autoposter-autoposter.php / php
<?php
//del.icio.us account information
define('DELICIOUS_USERNAME','username');
define('DELICIOUS_PASSWORD','password');
//wordpress information
define('WP_USERNAME','admin');
define('WP_PASSWORD','password');
define('WP_XMLRPC_HOST','localhost');
define('WP_XMLRPC_URL','/wordpress/xmlrpc.php');
//bring in Snoopy goodness
include('lib/Snoopy.class.php');
//get rid of error Notices because Snoopy produces some
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//bring in xml-rpc for php
include('lib/xmlrpc.inc');
//bring in the del.icio.us Mashups PHP library made ealrier
include('lib/delicious_mashups.inc.php');
//get yesterday's date in CCYY-MM-DD
log = "post_content = "";
//grab yesterday's bookmarks via the del.icio.us API
do_api_call("/posts/get?","&dt=api_return['status'] == 200) {
//make sure we have some posts
if (isset(posts = post_content .= "<ul>";
foreach (post)
{
post['attributes']['HREF']."\">".post['attributes']['EXTENDED']))
post['attributes']['EXTENDED']."</p>";
}
post_content .=
"<em>Sorry, but I didn't save any bookmarks to del.icio.us today.</em>";
}
//create the xml-rpc client object
post = array();
post['description'] = paramaters = array(
php_xmlrpc_encode("1"),
php_xmlrpc_encode(WP_USERNAME),
php_xmlrpc_encode(WP_PASSWORD),
php_xmlrpc_encode(message = new xmlrpcmsg("metaWeblog.newPost",client->return_type = 'phpvals';
//send the XML-RPC message to the server
client->send(response->errstr != '')
response->errstr;
else
log .=
" DEL.ICIO.US API CALL FAILED - status code was ".log;
?>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.