Yonatan Ben-Nes wrote:
Hi,
I'm currently building an e-commerce site and I need to create the connection between the site and the server which validate the credit card. I'm trying to do it with CURL which will post all the information from a secured page (https) to another secure page, the code that i succeded to create so far is able to send from one secured page to another at my server but from some reason isnt able to connect to the cc server, when i tried to use curl through the shell i succeded to connect.
The code that im trying is (i reduced the amount of variables for the snippet):
$OrderID = "OrderID=".$OrderID."&";
$total = "total=".$total."&";
$URL = "URL=http://www.curtaincallproductions.com/ccall08/html/order/auth.phtml&";
$email = "email=".$b_email."&";
$Cardnum1 = "Cardnum1=".$Cardnum[1]."&"; $Cardnum2 = "Cardnum2=".$Cardnum[2]."&"; $Cardnum3 = "Cardnum3=".$Cardnum[3]."&"; $Cardnum4 = "Cardnum4=".$Cardnum[4]."&"; $Cardname = "Cardname=".$Cardname; $params = $OrderID.$total.$URL.$email.$Cardnum1.$Cardnum2.$Cardnum3.$Cardnum4.$Cardname;
$params = str_replace(" ", "%20", $params);
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$ch = curl_init('https://www.goemerchant7.com/cgi-bin/gateway/direct.cgi');
curl_setopt($ch, CURLOPT_POST, 1); // make a regular post
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); //"user-agent" header to be used curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$result = curl_exec ($ch); curl_close ($ch); }
Anyone know what can be the problem? I also know that if i just create a static form which post to the cc server the cc return me an error, with curl i cant know what is the error... or can i?
Thanks Alot in advance, ------------------------------------------------------ "My friends are worth gold to me, so I prefer to sell them and get rich!"
Ben-Nes Yonatan Canaan Surfing Ltd Tel: 972-4-6991122 Fax: 972-4-6990098 http://sites.canaan.co.il ------------------------------------------------------
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php