3

In phoenixframework, I need to create a post request, to send parameters to another server.

As I am newcomer to elixir, I am wondering how would I do so? is there a library for this purpose? or is it possible to initiate a post request without installing a new library? how?

simo
  • 20,548
  • 31
  • 101
  • 188

1 Answers1

1

You can use libraries such as httpoison to make http requests from any elixir code.

Note that XMLHttpRequest is a browser api for making http requests (and it's been a long time since it wasn't XML specific at all) - there's nothing 'special' about those requests in general. Many js libraries (including Jquery, prototype, etc) add a X-Requested-With header but that's just a convention.

Community
  • 1
  • 1
Frederick Cheung
  • 79,397
  • 6
  • 137
  • 164
  • Thanks, I just discovered httpc in erlang, do you encourage me to use :httpc or httpoison ? – simo Jun 06 '16 at 13:06
  • There are quite a few others ( https://github.com/h4cc/awesome-elixir#http ) - I don't know enough to recommend one over another. httpoison has worked fine for me – Frederick Cheung Jun 06 '16 at 13:11