Avatar of digitalwise
digitalwise

asked on 

https json cfhttp post

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

?>

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",
"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>

Open in new window

ColdFusion Language

Avatar of undefined
Last Comment
LajuanTaylor

8/22/2022 - Mon