0

We would like to send a http request with ethercard.h. But when we doing this

ether.browseUrl(PSTR("GET /"), "", website, my_callback);

We get a 400 bad request answer.

We would like to test http request like: -POST -HEAD -PUT -DELETE -TRACE -OPTIONS

But it seems only this is working:

ether.browseUrl(PSTR("/"), "", website, my_callback);

but why?

No_File
  • 1
  • 1

1 Answers1

0

For GET request you don't need to make a special definition. All requests are GET in default. That's why your request works without any definition. So i can share with you a POST request example. You can proceed from here:

Stash::prepare(PSTR("POST http://$F/$F.csv HTTP/1.0" "\r\n"
                "Host: $F" "\r\n"
                "Content-Length: $D" "\r\n"
                "Content-Type: application/x-www-form-urlencoded" "\r\n"
                "\r\n"
                "$H"),
    website, PSTR(PATH), website, stash.size(), sd);

It even has a link to its explanation. POST Request Example

Halil Sahin
  • 568
  • 1
  • 6
  • 25