I’m trying to get html from an old machine.
I’m able to successfully get a response on the command line with this (and I have a go program working as well):
curl 200.200.200.200/aaa/001 --user "user:password"
I get the error: “HTTP request failed: bad_request” when trying to do that with an Elixir script:
HTTPoison.start()
username = "user"
password = "password"
credentials_encoded = Base.encode64("#{username}:#{password}")
headers = [{"Authorization", "Basic #{credentials_encoded}"}]
case HTTPoison.get("200.200.200.200/aaa/001", headers) do
{:ok, %HTTPoison.Response{status_code: 200, body: body}} ->
IO.puts(body)
{:ok, %HTTPoison.Response{status_code: status_code}} ->
IO.puts("Received response with status code #{status_code}")
{:error, %HTTPoison.Error{reason: reason}} ->
IO.puts("HTTP request failed: #{reason}")
end
I’m able to make simple requests to other servers by altering the code slightly. I know the ip and authentication matches the working curl request, and go program.
Any advice is appreciated.






















