LoginSignup
20
24

More than 5 years have passed since last update.

wgetのpostのパラメータでurlを渡す

Posted at

様々な理由でwgetのpostのパラメータとして、urlを渡したい時はあるけど、&のエスケープは気をつけないといけない.

たとえば、{a: 1, b: 2}というパラメータを渡したいなら

wget --post-data="a=1&b=2" http://hogehoge.com/fuga/piyo

となるが、{url: "http://example.com/?a=1&b=2"}みたいなのを渡したい時は
&をescapeしてあげないといけない

escapeするには%26を使う。

wget --post-data="url=http://example.com/?a=1%26b=2" http://hogehoge.com/fuga/piyo
20
24
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
24