Hello guys , I am using httpoison client to make http requests but I am getting this response
{:error,
%HTTPoison.Error{
id: nil,
reason: {:tls_alert,
{:certificate_expired, 'received CLIENT ALERT: Fatal - Certificate Expired'}}
}}
I have tested on both erlang version 22 and 23 , and I am getting the same error.
These are my settings ;
HTTPoison.post("https://test.elearning.com/webservice/restjson/server.php",[], [ssl: [versions: [:"tlsv1.2"] , verify: :verify_none], recv_timeout: 5000 ])
I need some guidance on what I am doing wrong .
Thanks in advance
According to the error certificate is expired… What if you try to ignore certificate? providing option hackney: [:insecure]
HTTPoison.post("https://test.elearning.com/webservice/restjson/server.php",[], [
hackney: [:insecure],
ssl: [versions: [:"tlsv1.2"] , verify: :verify_none],
recv_timeout: 5000
])
RudManusachi:
hackney: [:insecure]
same error
07:40:19.831 [info] TLS client: In state certify at ssl_handshake.erl:1643 generated CLIENT ALERT: Fatal - Certificate Expired
{:error,
%HTTPoison.Error{
id: nil,
reason: {:tls_alert,
{:certificate_expired, 'received CLIENT ALERT: Fatal - Certificate Expired'}}
}}
iex(11)> HTTPoison.post("https://elearning.test.com/webservice/restjson/server.php?",[], [hackney: [:insecure], ssl: [versions: [:"tlsv1.2"] , verify: :verify_none], recv_timeout: 5000 ])
15:08:16.944 [info] TLS client: In state certify at ssl_handshake.erl:1643 generated CLIENT ALERT: Fatal - Certificate Expired
{:error,
%HTTPoison.Error{
id: nil,
reason: {:tls_alert,
{:certificate_expired, 'received CLIENT ALERT: Fatal - Certificate Expired'}}
}}
same error ,
I need some help and work round
I am not able to open your used address…
https://test.elearning.com/webservice/restjson/server.php
Maybe try on another site.
@kokolegorille , can show me test for HTTpoison client with request on the https url , I share fake url trying to show my layout , for purposes of privacy , I cannot share the company internal url on the public forum
I will happy to get solution or example to help me out thanks
Thanks guys for the support I have found the solution ```
ssl: [versions: [:“tlsv1.2”]]
iex(20)> HTTPoison.post(“https://elearning.zeevarsity.com/webservice/restjson/server.php?wstoken=b2b77c4ee60279717582ff4faf804b76&wsfunction=core_course_create_categories&categories[0][name]=SCHOOL%20OF%20ENGINEERING&categories[0][idnumber]=SE ”,[],[], [ssl: [versions: [:“tlsv1.2”]]] )
{:ok,
%HTTPoison.Response{
body: “<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<EXCEPTION class=“moodle_exception”>\ncategoryidnumbertaken\nID number is already used for another category\n\n”,
headers: [
{“Date”, “Sun, 19 Jul 2020 20:34:32 GMT”},
{“Server”, “Apache/2.4.6 (CentOS) PHP/7.2.32”},
{“X-Powered-By”, “PHP/7.2.32”},
{“Content-Disposition”, “inline; filename=“response.xml””},
{“Cache-Control”,
“private, must-revalidate, pre-check=0, post-check=0, max-age=0”},
{“Expires”, “Thu, 01 Jan 1970 00:00:00 GMT”},
{“Pragma”, “no-cache”},
{“Accept-Ranges”, “none”},
{“Access-Control-Allow-Origin”, “*”},
{“Content-Length”, “201”},
{“Content-Type”, “application/xml; charset=utf-8”}
],
request: %HTTPoison.Request{
body: [],
headers: [],
method: :post,
options: [ssl: [versions: [:“tlsv1.2”]]],
params: %{},
url: “https://elearning.test.com/webservice/restjson/server.php?wstoken=b2b77c4ee60279717582ff4faf804b76&wsfunction=core_course_create_categories&categories[0][name]=SCHOOL%20OF%20ENGINEERING&categories[0][idnumber]=SE ”
},
request_url: “https://elearning.test.com/webservice/restjson/server.php?wstoken=b2b77c4ee60279717582ff4faf804b76&wsfunction=core_course_create_categories&categories[0][name]=SCHOOL%20OF%20ENGINEERING&categories[0][idnumber]=SE ”,
status_code: 200
}}``