简体   繁体   中英

Encode URL variable with curl

I have a rest endpoint that looks like this http://someurl.com/ {some_id}

I need to be able to make a GET request to that using the curl command from linux, and I need to be able to send the variable url encoded

if I try curl -G -v 'http://someurl.com' --data-urlencode 's*9678&as' it adds the ? in front, I want to be able to send the "some_id" as part of the path

Use urlencode . If on ubuntu

$ sudo apt-get install gridsite-clients

then

$ curl -G -v  "http://someurl.com/$(urlencode 's*9678&as')"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM