M-OZ BLOG

Scheme-users.jpTwitter

# 2010/01/15(Fri) : MzScheme でつぶやく
MzScheme で twitter に投稿するプログラムを書いてみた。

(require net/url
  net/uri-codec
  net/base64)

(define (tweet id pw msg)
 (let ((port
   (post-pure-port
    (string->url (string-append
     "http://twitter.com/statuses/update.xml?"
     (alist->form-urlencoded `((status . ,msg)))))
    #f
    (list (string-append "Authorization: Basic "
     (bytes->string/utf-8 (base64-encode
      (string->bytes/utf-8 (string-append id ":" pw)))))))))
  (display-pure-port port)
  (close-input-port port)))

(tweet id password message)

ポイントは POST なのに GET 風にパラメータを送ってるところ。

[TOP] [ALL]