We help IT Professionals succeed at work.
Get Started

https json cfhttp post

digitalwise asked
Last Modified: 2016-01-28
We received this sample code in php


$json_request = <<<JSON
"api_key": "1231231",
"remote_user_id": "123456",
"firstname": "Teston",
"lastname": "Testor",
"email": "test@example.com",
"remote_product_id": "EXAMPLE_REMOTE_ID",
"amount_paid": "0.00",

$eox_api_url = "https://theurl";

$curl_cmd = "/usr/bin/curl -X POST -d '$json_request' $eox_api_url --header \"Content-Type:text/json\"";

$eox_api_response = `$curl_cmd`;

print $eox_api_response


Open in new window

and I am trying to get it to work in coldfusion but getting a I/O Exception: peer not authenticated error message in dump so my guess is I have something wrong in my code

<cfset stFields =
"api_key": "123456789012345678901234567890",
"remote_user_id": "1231",
"firstname": "Test",
"lastname": "Test",
"email": "test@test.com",
"remote_product_id": "1231",
"amount_paid": "33",

<cfhttp url="https://theurl" method="post" result="httpResp" timeout="60">
    <cfhttpparam type="header" name="Content-Type" value="application/json" />
    <cfhttpparam type="body" value="#serializeJSON(stFields)#">

Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE