0

I know there are lot of questions similar to this, but no one helped me.

I have to make a C program, using socket and no external lib, that sends an HTTP POST request to a web server and manage its JSON answer.

The URL is like this:

meswebapptest.hermanmiller.com/mes/rest/r2Label/print/userId/company/unitId/prodOrder/printer

i.e.

meswebapptest.hermanmiller.com/mes/rest/r2Label/print/Biesse/105/1B6D0X-----11225105/112251/Q0161B8

So my question is: How the string should be formatted to match that URL?

Thanks in advice.

Matteo Pacini
  • 21,796
  • 7
  • 67
  • 74
  • 1
    Possible duplicate of [Simple C example of doing an HTTP POST and consuming the response](https://stackoverflow.com/questions/22077802/simple-c-example-of-doing-an-http-post-and-consuming-the-response) – Irelia Jun 18 '19 at 20:31
  • I don't think it is a duplicate of that one. There the content is sent as "Key1=Value1&Key2=Value2" cause the url is like "api.somesite.com/apikey=ARG1&command=ARG2". How can i send the content if the url is "meswebapptest.hermanmiller.com/mes/rest/r2Label/print/Biesse/105/1B6D0X-----11225105/112251/Q0161B8"? – Giuseppe Tufano Jun 18 '19 at 21:54
  • `char request[] = "POST /mes/rest/r2Label/print/Biesse/105/1B6D0X-----11225105/112251/Q0161B8 HTTP/1.1\r\nHost: meswebapptest.hermanmiller.com\r\nContent-Lenght:9\r\n\r\nname=nina";` – Irelia Jun 19 '19 at 04:09

0 Answers0