How to include an '&' character in a bash curl statement

前端 未结 7 1197
萌比男神i
萌比男神i 2020-11-28 09:14

I\'m trying to use curl in bash to download a webpage, but the & symbol in the URL isn\'t interpreted as a character as I would like. Any ideas on how I can

相关标签:
7条回答
  • 2020-11-28 09:46
    curl "http://www.example.com?m=method&args=1"
    

    Are you using the & as a delimiter for a GET URL? Or is in a piece of data?

    If it is in data you must encode it to an HTML character, if not, surround with quotes.

    The encoding for & should become %26 in the URL.

    curl "http://www.example.com?m=this%26that
    
    0 讨论(0)
提交回复
热议问题