Search code examples
curlcookiescommand-lineproxyhttp-referer

CURL command line with lots of parameters, referer, cookie and proxy. Error 400 Bad Request


I am trying to execute this CURL command, but I always get Error 400 Bad Request:

curl -v -k -G -X 'GET' --include --referer https://referer-corporatename.com --cookie "MyCookie=Value" --proxy proxy-corporatename.com:9502 https://application.corporate.com/page -d key1=value1 -d key2=value2 -d key3=value3 -d key4=value4 -d key5=value5 -d key6=value6

I also tried to attach the parameters (now in the form -d key=value) directly to the URL (like https://application.corporate.com/page&key1=value1&key2=value2&etc..., but I always get the same error 400.

What is the correct syntax for such a command?

Thank you very much for your help!


Solution

  • Best way is to use POSTMAN, give your parameters as GUi and then generate equivalent CURL command

    For Form Data

    -F key1=val1 \
      -F key2= val2