]>
Tony Duckles's Git Repositories (git.nynim.org) - delicious-utils.git/blob - delicious-dump/delicious-dump-allposts.php
3 Name: delicious-dump-allposts.php
4 Description: Makes a "posts/all" Delicious API call and writes the output to
5 stdout. If there's any problems, error-messages are written to stderr.
6 Author: Tony Duckles <tony@nynim.org>
8 Uses the fantastic "php-delicious" library created by E.J. Eliot:
9 http://www.phpdelicious.com/
12 1) Create the "auth_info.inc.php" file, with your Delicious username and
15 // Private username+password info
16 define('AUTH_DELICIOUS_USERNAME', 'username');
17 define('AUTH_DELICIOUS_PASSWORD', 'password');
19 2) Run this script and redirect the output as needed:
20 $ php delicious-dump-allposts.php > delicious-posts.xml
23 // Load php-delicious library
24 require('php-delicious/php-delicious.inc.php');
25 // Load the (private) "auth_info.inc.php" file
26 require('auth_info.inc.php');
28 $sCmd = PHP_DELICIOUS_BASE_URL
.'posts/all';
29 $oPhpDelicious = new PhpDelicious(AUTH_DELICIOUS_USERNAME
, AUTH_DELICIOUS_PASSWORD
);
30 if ($sXml = $oPhpDelicious->HttpRequest($sCmd)) {
31 if (strlen($sXml) > 0) {
32 // Strip last two lines off the file, because these contain a timestamp
33 $sXml = substr($sXml, 0, strrpos($sXml,"\n"));
34 $sXml = substr($sXml, 0, strrpos($sXml,"\n"));
36 fwrite(STDOUT
, $sXml);
39 fwrite(STDERR
, "Error making HttpRequest(\"sCmd\"): LastErrorNo = ".$oPhpDelicious->LastErrorNo()."\n");