请求帮忙! 从PHP 装换为 coldfusion

jayleongwk 2014-06-12 04:08:49
请求大大能帮我把以下的PHP转换为coldFusion吗?
$connection = curl_init($url);
$curl_options = array(CURLOPT_HTTPHEADER=>$headers, CURLOPT_POSTFIELDS=>$post_fields,
CURLOPT_POST=>1, CURLOPT_RETURNTRANSFER=>1); # data will be returned as a string
curl_setopt_array($connection, $curl_options);
$json_response = curl_exec($connection);
if (curl_errno($connection) > 0) {
echo curl_error($connection) . "\n";
exit(2);
}
curl_close($connection);
$response = json_decode($json_response,true);
$token = $response['fetchTokenResponse']['authToken'];
echo "Token: $token \n";
echo "Response: \n";
print_r($response);
...全文
3265 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Dogfish 2014-06-26
  • 打赏
  • 举报
回复
<cfhttp method="post" url="your url" throwonerror="Yes"> <cfhttpparam type="header" name="user-agent" value="somevalue" <cfhttpparam name="form_test1" type="FormField" value="Value1"> <cfhttpparam name="form_test2" type="FormField" value="Value1"> <cfhttpparam name="form_test3" type="FormField" value="Value1"> </cfhttp> <cfif cfhttp.StatusCode neq "200 OK"> <cfoutput>HTTP Error: #cfhttp.StatusCode#</cfoutput> <cfelse> <cfif isJSON(cfhttp.filecontent)> <cfdump var="#deserializeJSON(cfhttp.filecontent)#" label="HTTP Body" /> </cfif> </cfif>

879

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 ColdFusion
社区管理员
  • ColdFusion社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧