body {font-family: monospace } a { color: blue ; text-decoration: none }";
print "clickless del.icio.us poster
";
print "bookmarklet: $username
";
print "For firefox, save the bookmarklet in your bookmarks somewhere, look in its properties, and set the keyword field to something. ";
print "Then you can enter \"<keyword> <tag2> <tag2> ...\" in the url field and hit enter to submit to del.icio.us.
";
print "For safari, drag the bookmarklet to your bookmarks toolbar. ";
print "Then, click the bookmarklet to submit the page. If default_tags is set all posts will have those tags, otherwise they will be tagged system:unfiled.
";
print "page title will be sent as description.
";
print "selected text on page will be sent as extended.
";
} else {
$tags = urlencode($_GET['tags']);
$description = urlencode(stripslashes($_GET['description']));
if( $tags == "%25s" ) {
$tags = "";
}
if( $default_tags ) {
$tags = $tags."%20".urlencode($default_tags);
}
if( !$description ) {
$description = urlencode($_GET['url']);
}
$url="https://api.del.icio.us/v1/posts/add?url=".urlencode($_GET['url'])."&description=$description&tags=$tags&extended=".urlencode(stripslashes($_GET['extended']));
$ch = curl_init("$url");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt ($ch, CURLOPT_USERAGENT, $_ENV['HTTP_USER_AGENT']);
$response = curl_exec($ch);
curl_close($ch);
if( !ereg("code=\"done\"",$response) ) {
print "an error occured";
die;
}
header("Location: ".$_GET['url']);
}
?>