VincentBlackdot
how do i post data to a url with its parameters eg
www.sendmessage.com/client/xml/send?client&pass&message&phone
i want to pick the fields client, pass, message and phone from the db and pass them to a function like
def send_msg(entry) do
{:ok, url} ->
options = [
hackney: [basic_auth: {url.client, url.pass}],
ssl: [verify: :verify_none]]
{:ok, post_params} = prepare_request_params(entry, url)
case HTTPoison.post(String.trim(url.url), post_params, headers, options) do
{:ok, %HTTPoison.Response{status_code: 200, body: body}} ->
IO.inspect(process_response_body(body))
end
end
def prepare_request_params(entry, url) do
{:ok,Poison.encode!(%{
"username" => "#{url.client}",
"password" => "#{url.pass}",
"recipient" => ["#{entry.phone}"],
"message" => "#{entry.message}"
})}
end
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
So i have been using ash framework for a while and i love it. However currently the issue im having with ash framework is the error handl...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 7- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
dmitrykleymenov
The short answer is you can’t. POST request is created for hiding its body. And it’s hard to understand how will you use it, since code is invalid. I’m pretty sure you need something different than using url parameters in post request. Explain what do you need to achieve in a bigger scale.
If you build your
urlinside your app, you don’t need to interpolateusernameandpassto it, transfer them separately.VincentBlackdot
i am sending bulk messages and my sms vendor’s structure for sending messenges requires its done like this
gregvaughn
Aside: this is a very strange construction. Don’t use the
!version ofPoison.encodeif you want an :ok tuple as a return value. Just take away the!and you’ll get an :ok tuple. (Also, Poison is an old library not much used for new code these days).dmitrykleymenov
Is
www.sendmessage.commaintained by you or is it external resource?VincentBlackdot
what do you recommend I use in place of poison.
VincentBlackdot
it is maintained by an external resource. do note that www.sendmessage.com is the not actual vendors link am connecting to. its just an example link.
dmitrykleymenov
I would check the requirements of API. Are you sure that they need url parameters in url for post request with doubling it inside
POSTbody? May be it’s GET, or they don’t need params in url?