CPB*_*B07 2 php cookies coldfusion curl cfhttp
我正在尝试在ColdFusion中重新创建一个PHP函数(因为我不知道PHP)并认为我的大多数函数都不是太糟糕但在处理PHP中的cURL函数时遇到问题.
功能代码是
$cookie_string = $this->EASW_KEY."; ".$this->EASF_SESS ."; ".$this->PHISHKEY;
$ch = curl_init($search);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIE, $cookie_string);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'x-http-method-override: GET',
$this->XSID)
);
//Contains the JSON file returned
$EAPSEARCH = curl_exec($ch);
curl_close($ch);
unset (List of variables);
Run Code Online (Sandbox Code Playgroud)
我假设CFHTTP功能是我最好的盟友,但不确定如何处理重新编码.有人能指出我正确的方向吗?
bar*_*nyr 12
你是对的,CFHTTP是要走的路.以下是您上面转换为CFHTTP电话的电话版本:
<cfhttp url="http://some.server/path" method="POST" result="resultName>
<cfhttpparam type="cookie" name="EASW_KEY" value="#EASW_VALUE#" />
<cfhttpparam type="cookie" name="EASF_SESS" value="#EASF_SESS_VALUE#" />
<cfhttpparam type="header" name="Content-Type" value="application/json" />
<cfhttpparam type="header" name="x-http-method-override" value="GET" />
<cfhttpparam type="body" value="#myJSONStringVariable#" />
</cfhttp>
<cfdump var="#resultName# />
Run Code Online (Sandbox Code Playgroud)
这里记录了cfhttp标记:http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_g-h_09.html
| 归档时间: |
|
| 查看次数: |
2607 次 |
| 最近记录: |