troubleshooting Question

https json cfhttp post

Avatar of digitalwise
digitalwise asked on
ColdFusion Language
1 Comment1 Solution1343 ViewsLast Modified:
We received this sample code in php

<?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",
"send_email":true
}
JSON;

$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

?>

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",
"send_email":true
}>

<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)#">
</cfhttp>
ASKER CERTIFIED SOLUTION
LajuanTaylor

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros