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