teksigns Posted February 20, 2003 Share Posted February 20, 2003 Please Help ! Im trying to get authorizenet working again . i was using sambar as my server with php and curl as a extension of perl . i made this change to my authorizenet_direct.php file and it started working : unset($response); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://secure.authorize.net/gateway/transact.dll"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $response=curl_exec($ch); curl_close ($ch); however i started running into problems because most scripts where wrote for apache . so i desided to switch my server to apache ...... i done so and everyhting is working except my authorizenet module is not working now . i get this error on checkout There has been an error processing your credit card. Please try again. im running windows xp Pro sp1 apache 2.0.44 php 4.3.2 php Curl extension libcurl/7.10.2 OpenSSL/0.9.7 i have my server in test mode and testmode enabled in authorizenet admin section . i have tryed all these test cards with same error. 370000000000002 5424000000000015 4007000000027 4111111111111111 Link to comment Share on other sites More sharing options...
teksigns Posted February 21, 2003 Author Share Posted February 21, 2003 anyone have any help ! i have tried echoing out the data sent to authorizenet and i recieve x_Login=xxxxxxx x_PASSWORD=xxxxxxxxxxx x_Delim_Data=TRUE x_Version=3.1 x_Type=AUTH_CAPTURE x_Method=CC x_Amount=6.10 x_Card_Num=xxxxxxxxxxxxxx x_Exp_Date=xxxx x_Card_Code=xxx x_Email_Customer=TRUE x_Email_Merchant=TRUE x_Cust_ID=2 x_First_Name=Brian x_Last_Name=xxxxx x_Address=xxx xxmly Ln x_City=xxxxxxxxxxx x_State=xxxxxxxxxxxx x_Zip=xxxxx x_Country=United States x_Phone=xxxxx-xxxx x_Email=xxxxxxxxxxxxxx x_Ship_To_First_Name=Brian x_Ship_To_Last_Name=xxxxxx x_Ship_To_Address=xxx xxmly Ln x_Ship_To_City=xxxxxxxxxxx x_Ship_To_State=xxxxxxxxx x_Ship_To_Zip=xxxxx x_Ship_To_Country=United States x_Customer_IP=192.168.0.3 x_Description=1-test osCsid=718855b903e15b1c84f79b10bd7804e7 -------------------------------------------- i then tried echoing out the responce from authorize net and all i get is a blank page . i have tried using both the exe version and the one built into php. someone has bound to know how to get this running on windows . help ! Link to comment Share on other sites More sharing options...
teksigns Posted February 21, 2003 Author Share Posted February 21, 2003 FIXED ! this is what i done ......... before on sambar server i was using : unset($response); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://secure.authorize.net/gateway/transact.dll"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $response=curl_exec($ch); curl_close ($ch); well when i switch to apache this seemed to stop working . this is what found out : taken from http://php.planetmirror.com/manual/en/ref.curl.php from SSLCERTS file in curl source directory:"Starting in 7.10, libcurl performs peer SSL certificate verification by default. If the remote server uses a self-signed certificate, or if you don't install curl's CA cert bundle or if it uses a certificate signed by a CA that isn't included in the bundle, then you need to do one of the following: 1. Tell libcurl to *not* verify the peer. With libcurl you disable with with curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE); With the curl command tool, you disable this with -k/--insecure. so, in php, you need do the following: curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); i would be sure my connection don't crash, but since i didn't find any other documentation available, i add also the following: curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); from php manual: "CURLOPT_SSL_VERIFYHOST: Pass a long if CURL should verify the Common name of the peer certificate in the SSL handshake. A value of 1 denotes that we should check for the existence of the common name, a value of 2 denotes that we should make sure it matches the provided hostname. " so this is what i done : i changed my orginal to read like this : unset($response); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://secure.authorize.net/gateway/transact.dll"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $response=curl_exec($ch); curl_close ($ch); this seemed to fix it : the reason why is because im using a test cert and curl trys to verify it and fails . by adding the 2 lines it stops the verify process . or at least it seems . anyways this works well with apache and windows xp. for those that are just starting and using windows just change the bit in authorizenet_direct.php near the bottom . change the original code from : unset($response); // Post order info data to Authorize.net, make sure you have curl installed exec("/usr/bin/curl -d "$data" https://secure.authorize.net/gateway/transact.dll", $response); change it to : unset($response); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://secure.authorize.net/gateway/transact.dll"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $response=curl_exec($ch); curl_close ($ch); hope this helps someone i was about to loose my mind Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.