将PHP值返回到Coldfusion页面?

时间:2013-08-09 22:59:00

标签: php coldfusion parameter-passing

我正在为PHP页面做一个cfhttp帖子:

<cfhttp method="Post" url="https://www.example.com/ssl/roundpoint.php" result="mlResponse"> 

<cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0"> 
<cfhttpparam type="Header" name="TE" value="deflate;q=0">
<cfoutput>

    <cfif isdefined( "ppcid" )><cfhttpparam name="PPCID" type="formField" value="#PPCID#"></cfif>
    <cfif isdefined( "product")><cfhttpparam name="PRODUCT" type="formField" value="#PRODUCT#"></cfif>
    <cfif isdefined( "va_status" )><cfhttpparam name="VA_STATUS" type="formField" value="#VA_STATUS#"></cfif>
    <cfif isdefined( "qs_product")><cfhttpparam name="QS_PRODUCT" type="formField" value="#QS_PRODUCT#"></cfif>
    <cfif isdefined( "prop_st" ) and prop_st neq ""><cfhttpparam name="PROP_ST" type="formField" value="#PROP_ST#"></cfif>

</cfoutput>
</cfhttp>

在PHP页面上,我执行cURL函数,在结果中查找特定值并保存:

 $pstVars = '';

 if (count($_REQUEST) > 0) {
    foreach($_REQUEST as $key=>$value) {
       $pstVars .= $key . '=' . urlencode($value) . '&';
     }

    $pstVars .= 'ON_SUBMIT=YES';


    //the SSL/ORGANIC redirect API url 
    $url = 'https://www.example.com/ssl/redirect.php';


    //make the server-side redirect API call
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $pstVars);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    //store the result from the API call
    $roundpoint_result = curl_exec($ch);

    // LOOKING FOR ROUNDPOINT FLAG
    $rpVals = substr($roundpoint_result, 0, 10);

出于测试目的,我已经通过电子邮件发送了$ rpVals值以确保其正确无误。我需要将该值传递回Coldfusion页面。我已经尝试将值传递给cookie:

 setcookie('RPCOOKIE', $rpVals, time()+60*60*24*2, '/', '.example.com');

并试图在ColdFusion页面上阅读它:

<cfparam name="RPCOOKIE" default=""/>
<cfcookie name="RPCOOKIE" value="#RPCOOKIE#">

但我对此没有任何好运,无论是设置cookie还是在ColdFusion中读取它。有什么建议吗?

(仅供参考 - Coldfusion页面将在几周后用PHP重写,但客户端要求时间敏感的东西。)

0 个答案:

没有答案