Common Lisp のひとつである、ecl の http Post のサンプルです。
quicklisp.lisp のインストールが済んでいるものとします。
ecl_post.lisp
#! /usr/bin/ecl -shell
; -------------------------------------------------------------------
; ecl_post.lisp
;
; Mar/02/2018
;
; -------------------------------------------------------------------
(format t "*** 開始 ***~%")
(load "~/quicklisp/setup.lisp")
(ql:quickload :drakma)
(defvar out_str)
(setf out_str (flexi-streams:octets-to-string
(drakma:http-request "http://httpbin.org/post" :method :post
:parameters '(("user" . "jiro") ("password" . "123456"))
)
))
(format t out_str)
(format t "*** 終了 ***~%")
(quit)
; -------------------------------------------------------------------
実行結果
$ ./ecl_post.lisp
*** 開始 ***
;;; Loading "/home/uchida/quicklisp/setup.lisp"
;;; Loading #P"/usr/lib/ecl-16.1.3/asdf.fas"
To load "drakma":
Load 1 ASDF system:
drakma
; Loading "drakma"
{
"args": {},
"data": "",
"files": {},
"form": {
"password": "123456",
"user": "jiro"
},
"headers": {
"Accept": "*/*",
"Connection": "close",
"Content-Length": "25",
"Content-Type": "application/x-www-form-urlencoded",
"Host": "httpbin.org",
"User-Agent": "Drakma/2.0.4 (ECL 16.1.3; Linux; 4.15.5-1-ARCH; http://weitz.de/drakma/)"
},
"json": null,
"origin": "163.49.205.60",
"url": "http://httpbin.org/post"
}
*** 終了 ***