Below is a call rail API request in PHP. This works in PHP, but I need to run this in ColdFusion. I've tried every combination of cfhttp and cfhttpparam I can think of that looks correct, and have tried it using JSON, but I always get a 401 Unauthorized response. Anyone ever done the Call Rail API in CF or have any ideas on the code below. I'm about out of ideas.
Thanks <?php $api_url = 'https://api.callrail.com/v1/companies.json'; // Replace with your API Key $api_key = 'MYKEYHERE'; $ch = curl_init($api_url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Token token=\"{$api_key}\"")); $json_data = curl_exec($ch); $parsed_data = json_decode($json_data); curl_close($ch); // Examine meta data from the response $total_entries = $parsed_data->total_entries; echo "Total entries: {$parsed_data->total_entries} \n"; // Loop through companies foreach($parsed_data->companies as $company){ echo "Company: {$company->name} \n"; } ?> Robert Harrison Full Stack Developer AIMG <mailto:rharri...@aimg.com> rharri...@aimg.com Main Office: 704-321-1234 ext.121 Direct Line: 516-302-4345 <http://www.aimg.com/> www.aimg.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359991 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm