Posted By


jugyo on 10/20/06

Tagged


Statistics


Viewed 262 times
Favorited by 0 user(s)

delicious_test.php


/ Published in: PHP
Save to your folder(s)

deliciousにポストするサンプル


Copy this code and paste it in your HTML
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.  
  4. <title>delicious_test</title>
  5.  
  6. <body>
  7.  
  8. <?php
  9.  
  10. postBookmark("id", "pass", "title", "http://...", "comment...", "tags...");
  11.  
  12. function postBookmark($account,$password,$title,$url,$comment,$tag="") {
  13. $title = mb_convert_encoding($title, "UTF-8", "eucjp-win");
  14. $comment = mb_convert_encoding($comment, "UTF-8", "eucjp-win");
  15. $tag = mb_convert_encoding($tag, "UTF-8", "eucjp-win");
  16. $url = urlencode($url);
  17. $title = urlencode($title);
  18. $comment = urlencode($comment);
  19. $tag = urlencode($tag);
  20. $cmd = 'curl --silent --user '
  21. . $account . ':' . $password
  22. . ' -o "response.xml"'
  23. . ' -O "https://api.del.icio.us/v1/posts/add?url='
  24. . "$url&description=$title&extended=$comment&tags=$tag&" . '"';
  25. system($cmd);
  26. }
  27. ?>
  28.  
  29. </body>
  30. </html>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.