dongxie548548 2012-06-22 20:49
浏览 44

将World Pay Payment Gateway与PHP集成

Implementing worldpay payment gateway is driving me nuts. I am trying to implement worldpay payment gateway in a php website using XML direct method. I am using the code from here to handle all the HTTP requests.

But whenever I try to connect to their server I get error message that Authorization is required. I have supplied all the required details in the following url

$dest="https://$merchantCode:$password@secure-test.wp3.rbsworldpay.com/jsp/merchant/xml/paymentService.jsp";

Even when I use curl to connect to their server I get error message that url is not found.

Following is the curl code I am using.

    $ch = curl_init ($url);
    curl_setopt($ch, CURLOPT_POST,1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$xml);   //$xml is the xml string
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_NOPROGRESS, 0);

    $result = curl_exec ($ch); // result will contain XML reply from WorldPay curl_close ($ch);
    if ( $result == false )
    {
    $error = "Curl could not retrieve page '$url', curl_exec returns false";               
    }
    echo $error;
    echo $result;

As there is no proper documentation, I request whoever has implemented it to please help me.

Currently I am testing the PHP website on my localhost. Is that the reason that the HTTP request or the curl is not working

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
    • ¥20 Java-Oj-桌布的计算
    • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
    • ¥20 有人知道这种图怎么画吗?
    • ¥15 pyqt6如何引用qrc文件加载里面的的资源
    • ¥15 安卓JNI项目使用lua上的问题
    • ¥20 RL+GNN解决人员排班问题时梯度消失
    • ¥60 要数控稳压电源测试数据
    • ¥15 能帮我写下这个编程吗
    • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路