4

I'm working to Open Stack in particular to Swift All in One (SAIO). I need to use C++ and libcurl for authentication.

Using curl via terminal I use this command (and it works);

curl -v -H 'X-Auth-User: $SWIFTACCOUNT:$SWIFTUSER' -H 'X-Auth-Key: $SWIFTPASSWORD'

How can I run this command with libcurl in C++?

Niall
  • 30,036
  • 10
  • 99
  • 142
cirux91
  • 105
  • 3

1 Answers1

1

Append --libcurl code.c to your command line and you'll get a fine first template to start off from!

CURLOPT_HTTPHEADER is the option to curl_easy_setopt you need.

See also httpcustomheader.c for a full libcurl example using custom HTTP headers.

Daniel Stenberg
  • 54,736
  • 17
  • 146
  • 222