CURL to Coldfusion - Send fax using Twilio.
I am trying to use Twilio to get rid of our fax machine (why do they still exist?!?). I've got inbound fax working but not outbound. They have examples for several languages here but no CF. I tried using their CURL example and converting it to CF but can't get it to work.
CURL:
curl -X POST https://fax.twilio.com/v1/Faxes \
--data-urlencode "From=+15017122661" \
--data-urlencode "To=+15555555555" \
--data-urlencode "MediaUrl=https://example.com" \
-u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
CF:
<cfhttp method = "post" result="result" url = "https://fax.twilio.com/v1/Faxes" username = "#session.TwilioAccountSID#" password = "#Session.TwilioAuthToken#">
<cfhttpparam type="header" name="Content-Type" value="application/x-www-form-urlencoded">
<cfhttpparam type = "body" encoded="no" value = " ""to=+15083930000"", ""from=+15086580000"", ""mediaUrl=http://someurl.me/faxtest.pdf"" ">
</cfhttp>
<cfdump var="#result#"> I get the following error:
{"code": 20001, "message": "Missing required parameter To in the post body", "more_info": "https://www.twilio.com/docs/errors/20001", "status": 400}. The URL says: One or more parameters you sent the REST API were not recognized and were ignored.
Appreciate any help!
Gary
