Newbie at PHP needs help with curl for payment gateway
Posted: Thu Sep 07, 2006 9:35 am
feyd | Please use
When I set up my payment module in debug mode, I do not see any error messages.
In your response, could you please be specific, as I am a php and programming virgin..LOL, only been introduced to it in the last 3 weeks.
Here you can see my site. http://www.inekesfashions.com.au
Many thanks for your help,
Goshawk
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi all,
I am new to all of this, and have just installed a ZenCart on my Host (GoDaddy)and I would like to include a payment gateway module, supplied by DirectOne (Australia). This needs to have curl support with ssl.
I have been pulling my hair out, as I have not been able to make a connections with DirectOne from my shopping cart. My site is secured, and https:// address is displayed in my cart. My server address is added to DirectOne, so it should accept my calls. Each time, it defaults to my index.php
I have contacted GoDaddy and they tell me that all is ok from their end. Here are my details:
[quote]CURL support enabled
CURL Information libcurl/7.10.6 OpenSSL/0.9.7a ipv6 zlib/1.2.3
PHP Version 5.1.4
This Web site is secured with a GoDaddy.com Web Server Certificate. Transactions on the site are protected with up to 256-bit Secure Sockets Layer encryption.[/quote]
How can I test my curl to make sure it is working correctly?
this is the code I am trying to submit:Code: Select all
unset($authorize);
if (MODULE_PAYMENT_DIRECTONE_TRANSACTION_MODE == 'Test') {
$url = 'https://vault.safepay.com.au/cgi-bin/direct_test.pl';
} else {
$url = 'https://vault.safepay.com.au/cgi-bin/direct_process.pl';
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, $data);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$authorize = curl_exec($ch);
curl_close ($ch);
// Begin Debug Section
if (MODULE_PAYMENT_DIRECTONE_DEBUG == 'True'){
echo $authorize;
echo $data;
echo $url;
exit();
}
// End Debug Section
$response = array_shift(split(" ",$authorize["summary_code"]));
//parse Directone response string
$authorize = explode("\n",$authorize);
for($i=0 ; $i<sizeof($authorize)-1 ; $i++)
{$authorize[$i] = trim($authorize[$i]);
$authorize[$i] = substr(strstr($authorize[$i], '='),1);
}
$payment_number = $authorize[0];
$payment_reference = $authorize[1];
$bank_reference = $authorize[2];
$summary_code = $authorize[3];
$response_code = $authorize[4];
$response_text = $authorize[5];
$time = time();In your response, could you please be specific, as I am a php and programming virgin..LOL, only been introduced to it in the last 3 weeks.
Here you can see my site. http://www.inekesfashions.com.au
Many thanks for your help,
Goshawk
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]