Tuan Le Posted January 16, 2004 Share Posted January 16, 2004 Up to date, I am not aware of anyone out there who got the Authorize.net module to work under Windows 2003 Server. I spent the last 3-4 weeks going through every single thread there is regarding to Authorize.net module but not seen a solution to this. All of the Win2003 users would be greatly appreciated if any developer/coder out there willing to give us a hand. (Due to various reasons, moving to a Linux platform is not an option.) Just to make sure it isn't caused by anything obvious, I will go over all the details on the test Windows 2003 Server. The box has OSC 2.2 MS2 running on top of PHP 4.3.4 and cURL (libcurl/7.10.5 OpenSSL/0.9.7b zlib/1.1.4). I tested PHP and cURL and they are both working. This is the first method I am trying to post info to Authorize.net exec("c:/curl/curl.exe -d \"$data\" https://secure.authorize.net/gateway/transact.dll", $response); This is the second method but it isn't working either. $url = "https://secure.authorize.net/gateway/transact.dll"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $authorize = curl_exec($ch); curl_close ($ch); $response = split(",", $authorize); Monitoring the firewall connection logs, I can see that it is connecting to 64.94.118.66 (secure.authorize.net) on port 443 when I hit the submit order button. After a few seconds it would jump back to https://www.mystore.com/catalog/checkout_process.php and give me the generic error message, "There has been an error connecting to Authorize.net" I spoke to Authorize.net and the guy in integration team sent me one of their test file. Below is the codes from that test file. I have already added the test account info and trasaction key into it. The file would work great on the Linux box. http://www.tlelectronics.com/test.php However, it doesn't work when I put it on the Windows 2003 server. And no error codes returned from Authorize.net either. http://www.piaawarehouse.com/test.php <!-- --> <html> <head> <title>AIM Example in PHP :: Authorize.Net</title> <style type="text/css"> <!-- body {background-color: #ffffff; color: #000000;} body, td, th, h1, h2 {font-family: sans-serif;} pre {margin: 0px; font-family: monospace;} a:link {color: #000099; text-decoration: none;} a:hover {text-decoration: underline;} table {border-collapse: collapse;} .center {text-align: center;} .center table { margin-left: auto; margin-right: auto; text-align: left;} .center th { text-align: center; !important } td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;} h1 {font-size: 150%;} h2 {font-size: 125%;} .p {text-align: left;} .q {background-color: #9999cc; font-weight: normal; color: #ffffff;} .e {background-color: #ccccff; font-weight: bold;} .h {background-color: #9999cc; font-weight: bold;} .v {background-color: #cccccc;} i {color: #666666;} img {float: right; border: 0px;} hr {width: 600px; align: center; background-color: #cccccc; border: 0px; height: 1px;} //--> </style> </head> <body> <div class="center"> <table border="0" cellpadding="3" width="600"> <tr class="h"> <td> <b>Authorize.Net<br> Advanced Implementation Method (AIM)<br> PHP Example Code</b><br> <br> This is just a test to:<br> 1) post an HTTP request to the secure Authorize.Net server<br> 2) process feedback from the secure Authorize.Net transaction DLL<br> <br> </td> </tr> <tr class="v"> <td> <?php $DEBUGGING = 1; # Display additional information to track down problems $TESTING = 1; # Set the testing flag so that transactions are not live $ERROR_RETRIES = 2; # Number of transactions to post if soft errors occur $auth_net_login_id = "tryitout123"; $auth_net_tran_key = "IefMPmMKjMMbfuD5"; $auth_net_url = "https://certification.authorize.net/gateway/transact.dll"; $authnet_values = array ( "x_login" => $auth_net_login_id, "x_version" => "3.1", "x_delim_char" => "|", "x_delim_data" => "TRUE", "x_url" => "FALSE", "x_type" => "AUTH_CAPTURE", "x_method" => "CC", "x_tran_key" => $auth_net_tran_key, "x_relay_response" => "FALSE", "x_card_num" => "4242424242424242", "x_exp_date" => "1205", "x_description" => "Recycled Toner Cartridges", "x_amount" => "12.23", "x_first_name" => "Charles D.", "x_last_name" => "Gaulle", "x_address" => "342 N. Main Street #150", "x_city" => "Ft. Worth", "x_state" => "TX", "x_zip" => "12345", "CustomerBirthMonth" => "Customer Birth Month: 12", "CustomerBirthDay" => "Customer Birth Day: 1", "CustomerBirthYear" => "Customer Birth Year: 1959", "SpecialCode" => "Promotion: Spring Sale", ); $fields = ""; foreach( $authnet_values as $key => $value ) $fields .= "$key=" . urlencode( $value ) . "&"; echo "<hr>"; /////////////////////////////////////////////////////////// echo "<b>01: Post the transaction (see the code for specific information):</b><br>"; $ch = curl_init("https://certification.authorize.net/gateway/transact.dll"); // URL of gateway for cURL to post to curl_setopt($ch, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1) curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim( $fields, "& " )); // use HTTP POST to send form data $resp = curl_exec($ch); //execute post and get results curl_close ($ch); echo "<hr>"; /////////////////////////////////////////////////////////// echo "<b>02: Get post results:</b><br>"; echo $resp; echo "<br>"; echo "<hr>"; /////////////////////////////////////////////////////////// echo "03: Parse post results (simple approach)<br>"; $text = $resp; echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"1\">"; echo "<tr>"; echo "<td class=\"v\">"; $tok = strtok($text,"|"); while(!($tok === FALSE)){ //while ($tok) { echo " ".$tok."<br>"; $tok = strtok("|"); } echo "</td>"; echo "</tr>"; echo "</table>"; echo "<hr>"; /////////////////////////////////////////////////////////// echo "<b>04: Parse the results string into individual, meaningful segments:</b><br>"; echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"1\">"; /////////////////////////////////////////////////////////// // STATISTICAL USE ONLY: // /////////////////////////////////////////////////////////// echo "<tr>"; echo "<td class=\"q\">"; echo "Length of the returned string from Authorize.Net:"; echo "</td>"; echo "<td class=\"q\">"; echo strlen($resp); echo "</td>"; echo "</tr>"; $howMany = substr_count($resp, "|"); echo "<tr>"; echo "<td class=\"q\">"; echo "Number of delimiter characters in the returned string:"; echo "</td>"; echo "<td class=\"q\">"; echo $howMany; echo "</td>"; echo "</tr>"; /////////////////////////////////////////////////////////// $text = $resp; $h = substr_count($text, "|"); $h++; for($j=1; $j <= $h; $j++){ $p = strpos($text, "|"); if ($p === false) { // note: three equal signs echo "<tr>"; echo "<td class=\"e\">"; // x_delim_char is obviously not found in the last go-around if($j>=69){ echo "Merchant-defined (".$j."): "; echo ": "; echo "</td>"; echo "<td class=\"v\">"; echo $text; echo "<br>"; } else { echo $j; echo ": "; echo "</td>"; echo "<td class=\"v\">"; echo $text; echo "<br>"; } echo "</td>"; echo "</tr>"; }else{ $p++; // We found the x_delim_char and accounted for it . . . now do something with it // get one portion of the response at a time $pstr = substr($text, 0, $p); // this prepares the text and returns one value of the submitted // and processed name/value pairs at a time // for AIM-specific interpretations of the responses // please consult the AIM Guide and look up // the section called Gateway Response API $pstr_trimmed = substr($pstr, 0, -1); // removes "|" at the end if($pstr_trimmed==""){ $pstr_trimmed="NO VALUE RETURNED"; } echo "<tr>"; echo "<td class=\"e\">"; switch($j){ case 1: echo "Response Code: "; echo "</td>"; echo "<td class=\"v\">"; $fval=""; if($pstr_trimmed=="1"){ $fval="Approved"; }elseif($pstr_trimmed=="2"){ $fval="Declined"; }elseif($pstr_trimmed=="2"){ $fval="Error"; } echo $fval; echo "<br>"; break; case 2: echo "Response Subcode: "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 3: echo "Response Reason Code: "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 4: echo "Response Reason Text: "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 5: echo "Approval Code: "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 6: echo "AVS Result Code: "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 7: echo "Transaction ID: "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 8: echo "Invoice Number (x_invoice_num): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 9: echo "Description (x_description): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 10: echo "Amount (x_amount): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 11: echo "Method (x_method): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 12: echo "Transaction Type (x_type): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 13: echo "Customer ID (x_cust_id): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 14: echo "Cardholder First Name (x_first_name): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 15: echo "Cardholder Last Name (x_last_name): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 16: echo "Company (x_company): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 17: echo "Billing Address (x_address): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 18: echo "City (x_city): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 19: echo "State (x_state): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 20: echo "ZIP (x_zip): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 21: echo "Country (x_country): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 22: echo "Phone (x_phone): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 23: echo "Fax (x_fax): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 24: echo "E-Mail Address (x_email): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 25: echo "Ship to First Name (x_ship_to_first_name): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 26: echo "Ship to Last Name (x_ship_to_last_name): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 27: echo "Ship to Company (x_ship_to_company): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 28: echo "Ship to Address (x_ship_to_address): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 29: echo "Ship to City (x_ship_to_city): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 30: echo "Ship to State (x_ship_to_state): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 31: echo "Ship to ZIP (x_ship_to_zip): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 32: echo "Ship to Country (x_ship_to_country): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 33: echo "Tax Amount (x_tax): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 34: echo "Duty Amount (x_duty): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 35: echo "Freight Amount (x_freight): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 36: echo "Tax Exempt Flag (x_tax_exempt): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 37: echo "PO Number (x_po_num): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 38: echo "MD5 Hash: "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; case 39: echo "Card Code Response: "; echo "</td>"; echo "<td class=\"v\">"; $fval=""; if($pstr_trimmed=="M"){ $fval="M = Match"; }elseif($pstr_trimmed=="N"){ $fval="N = No Match"; }elseif($pstr_trimmed=="P"){ $fval="P = Not Processed"; }elseif($pstr_trimmed=="S"){ $fval="S = Should have been present"; }elseif($pstr_trimmed=="U"){ $fval="U = Issuer unable to process request"; }else{ $fval="NO VALUE RETURNED"; } echo $fval; echo "<br>"; break; case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 55: case 56: case 57: case 58: case 59: case 60: case 61: case 62: case 63: case 64: case 65: case 66: case 67: case 68: echo "Reserved (".$j."): "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; break; default: if($j>=69){ echo "Merchant-defined (".$j."): "; echo ": "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; } else { echo $j; echo ": "; echo "</td>"; echo "<td class=\"v\">"; echo $pstr_trimmed; echo "<br>"; } break; } echo "</td>"; echo "</tr>"; // remove the part that we identified and work with the rest of the string $text = substr($text, $p); } } echo "</table>"; echo "<br>"; echo "<hr>"; /////////////////////////////////////////////////////////// echo "<b>04: Done.</b><br>"; ?> </td> </tr> </table> </div> </body></html> If any further details is needed, please let me know. Thanks -Tuan Link to comment Share on other sites More sharing options...
Guest Posted January 16, 2004 Share Posted January 16, 2004 We are not going to be able to help you if you can't get Authorize.net's test file to work. This is not a development issue, it is a system administration issue. Suggestions (no, I don't know how to do either of these): 1. Get a version of PHP for MS Windows that already has curl support installed. Note: this may not be possible. 2. Make sure that you have curl installed properly on your server. One way to test this would be to get a MS Windows specific test file and see if you can get that to work. Hth, Matt Link to comment Share on other sites More sharing options...
Tuan Le Posted January 16, 2004 Author Share Posted January 16, 2004 Hi Matt, I think you misunderstood my intention of this post. I totally understand that this is not a OSC development issues or Authorize.net module contribution issues. And I am definitely not pointing the finger at either one of them. All I am saying is that many people I know (if not all on here) are having problem getting Authorize.net to work on the Windows 2003 Server. And for the sake of people running OSC on Windows 2003, I am asking for a helping hand from developers and coders in getting this issue ressolved. :) I posted the test file from Authorize.net so everyone can see and use to test on their own Windows 2003 Server if needed. After all, this is the "Suggestions and Proposals" area. My suggestion/proposal is LET'S ALL WORK TOGETHER TO GET THIS AUTHORIZENET/WIN2003 ISSUE RESSOLVED. So that everyone can benefit from it. Cheers -Tuan Link to comment Share on other sites More sharing options...
Talegen Posted January 19, 2004 Share Posted January 19, 2004 Ok my first question is, do we know it's a Win2K3 issue? That is does this code work on a Win2K server? If it is Win2K3 then we need to figure out what has changed between versions. I know some of the networking architecture has so maybe the curl stuff isn't compatible. Of course if you've already tested it and it is working on Win2K3, then that's out as being the problem. Which means it could be either the data formating your passing to the authorize.net service, or something else. hmmm. If I can't figure this out, I'll post up the authorize.net code I wrote a while back for a client of mine. Link to comment Share on other sites More sharing options...
Guest Posted January 19, 2004 Share Posted January 19, 2004 W2K3 comes with very high firewall security built in, you have to do quite a bit to get it disabled. and there probably is a different version of curl which will have to be used with W2K3 i just thought of this, dont know if you have done it or not tho Windows CURL Extension Installation 1) For php_curl.dll, it's fairly easy, because its already included in the full Windows PHP distribution. In your php.ini (c:\winnt\), look for this line containing extension_dir, and make it match the following: extension_dir = "c:\php\extensions\" 2) Next, look for the line containing include_path, and be sure it looks like the following: include_path=".;c:\php" 3) Next, in the extensions section, look for the line containing php_curl.dll, and remove the semi-colon (;) from in front, so the line looks like this: extension=php_curl.dll Link to comment Share on other sites More sharing options...
Tuan Le Posted January 19, 2004 Author Share Posted January 19, 2004 W2K3 comes with very high firewall security built in, you have to do quite a bit to get it disabled. and there probably is a different version of curl which will have to be used with W2K3 i just thought of this, dont know if you have done it or not tho Windows CURL Extension Installation 1) For php_curl.dll, it's fairly easy, because its already included in the full Windows PHP distribution. In your php.ini (c:\winnt\), look for this line containing extension_dir, and make it match the following: extension_dir = "c:\php\extensions\" CHECKED! 2) Next, look for the line containing include_path, and be sure it looks like the following: include_path=".;c:\php" CHECKED! 3) Next, in the extensions section, look for the line containing php_curl.dll, and remove the semi-colon (;) from in front, so the line looks like this: extension=php_curl.dll CHECKED! Rob: I will find a Windows 2000 box to run that test file and will report back. :) John: I forgot to mention the modifications you listed above. However, they are were (and still are) in the php.ini file when I tested the authorize.net codes. :) -Tuan Link to comment Share on other sites More sharing options...
Austin519 Posted January 22, 2004 Share Posted January 22, 2004 Hmm...after already having replied to Tuan, I will say what I said in email here as well. It is definitely not a code issue. It is running on my Win2k box perfectly well. So it's not a Windows thing. So what are the possibilites if it's the same code running fine in (so far all that I have heard of) all versions of Apache both on Linux and Windows, and not your version? From the way it sounds, you are running IIS. That's one difference. You're also running Windows XP/2003 kernel, that's another. And of course since you're running IIS you're using a difference version of cURL and Apache. We could quickly rule the OS out as an issue if you try running a version of Apache on your box, and see if it works correctly. If so, then it's IIS or your versions of cURL and PHP. If not, it's the OS. Assuming we get down to it being IIS, then I would contact MS or go post on the IIS forums about this issue and see who's found a workaround, because I'm sure someone has. I hate to say it, but running code that wasn't originally intended for Windows, and was ported to it, and of course running Windows itself, you're already at a disadvantage. I'm still waiting for the money to build the Linux server box of my dreams, so for now I'm hosting the server on a little Win2k box. That said it was a pain in the butt to get it to work properly in 2k, god knows what it is with the XP kernel. Austin519 Link to comment Share on other sites More sharing options...
Tuan Le Posted January 23, 2004 Author Share Posted January 23, 2004 Hi Austin, Thank you so much for your input on this thread. I am running IIS6 on Windows 2003. However, your suggestion is great. In order to pin point whether the problem is with IIS6 or Windows 2003 itself, I will add Apache to my Win2003 box and see if I can get Authorize.net to work. I'll keep you guys posted. -Tuan Link to comment Share on other sites More sharing options...
Tuan Le Posted January 27, 2004 Author Share Posted January 27, 2004 I want to update everyone that running this Authorize.net test file on Apache 2 and Windows 2003 made no difference. Still have the exact same problem as when it was running on IIS6 and Windows 2003 Server. So now, the only variables left are PHP (4.3.4) and Windows 2003. Maybe there is certain PHP commands being used in the Authorize.net codes which aren't "fully compliant" when running on Windows 2003 server. Any other ideas/suggestions, guys? Link to comment Share on other sites More sharing options...
user99999999 Posted January 29, 2004 Share Posted January 29, 2004 I would check into the SSL side of curl. The files php_curl.dll uses for SSL mode are libeay32.dll, and ssleay32.dll located in the php/dlls dir and need to be on windows path somewhere. You can check the curl/ssleay sites about 2003 issues. You can easily test if curl and curl/SSL work by testing other URL's and echo your response. The post data should be urlencoded string, like get, or it will choke. $data = 'name="my name"&address="my address"'; Should be $data = 'name=my%20name&address=my%20address'; I find it best when using curl to make a local test server http://localhost/dump_post_vars.php <?php echo 'Start...' . var_dump($_POST) . '...End'; ?> Dave... Link to comment Share on other sites More sharing options...
Tuan Le Posted January 29, 2004 Author Share Posted January 29, 2004 Hi Dave, I checked the 2 files (libeay32.dll & ssleay32.dll) and they already in the C:\windows\system32 directory. And using this code to test the echo, below is the message I got. <?php echo 'Start...' . var_dump($_POST) . '...End'; ?> array(0) { } Start......End What should I look for? Thanks Dave. Link to comment Share on other sites More sharing options...
Tuan Le Posted January 29, 2004 Author Share Posted January 29, 2004 Using a the sample cURL test codes below, the results came back as expected so cURL seem to be working ok. You can run that test file on my Windows 2003 server. Here is the link http://www.piaawarehouse.com/test3.php <?php // FIND BOOKS ON PHP AND MYSQL ON AMAZON $url = "http://www.amazon.com/exec/obidos/search-handle-form/002-5640957-2809605"; $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s curl_setopt($ch, CURLOPT_POST, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS, "url=index%3Dbooks&field-keywords=PHP+MYSQL"); // add POST fields $result = curl_exec($ch); // run the whole process curl_close($ch); echo $result; ?> Link to comment Share on other sites More sharing options...
Tuan Le Posted January 30, 2004 Author Share Posted January 30, 2004 Can someone please take a look at my php setting info and see if I overlooked something? :unsure: :unsure: :unsure: http://www.piaawarehouse.com/phpinfo.php Link to comment Share on other sites More sharing options...
Tuan Le Posted February 7, 2004 Author Share Posted February 7, 2004 I moved it over to another Windows 2003 server and still have the same issues. :( Here is the link to the phpinfo on the new server http://www.litewarehouse.com/phpinfo.php Link to comment Share on other sites More sharing options...
♥ecartz Posted February 7, 2004 Share Posted February 7, 2004 When I click that link, I get Bad Request (Invalid Hostname)I didn't see anything wrong on the previous link. Hth, Matt Always back up before making changes. Link to comment Share on other sites More sharing options...
user99999999 Posted February 8, 2004 Share Posted February 8, 2004 Your amazon code was http so it didnt test the ssl part. Replace the auth.net url with your test server url in the payment module then place an order and you can see the results. $auth_net_url = "https://certification.authorize.net/gateway/transact.dll"; $auth_net_url = https://yourserver/dump_post_vars.php <?php //dump_post_vars.php echo 'Start...' . var_dump($_POST) . '...End'; ?> Also you will need an exit in there to see the results. $resp = curl_exec($ch); //execute post and get results curl_close ($ch); exit; Link to comment Share on other sites More sharing options...
Tuan Le Posted February 10, 2004 Author Share Posted February 10, 2004 Following your instruction, now I get a blank screen after I submit the order. :( If I go back to the Amazon codes below and change the link from http: to https: then I would get a blank screen for that codes also. Here is the link for that http://www.litewarehouse.com/test3.php <?php // FIND BOOKS ON PHP AND MYSQL ON AMAZON $url = "https://www.amazon.com/exec/obidos/search-handle-form/002-5640957-2809605"; $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s curl_setopt($ch, CURLOPT_POST, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS, "url=index%3Dbooks&field-keywords=PHP+MYSQL"); // add POST fields $result = curl_exec($ch); // run the whole process curl_close($ch); echo $result; ?> Link to comment Share on other sites More sharing options...
Tuan Le Posted February 10, 2004 Author Share Posted February 10, 2004 It looks like the "cURL with SSL" piece is not working correctly. My test codes below (with http only) run great. http://www.litewarehouse.com/test-curl.php But as soon as I change the link over to https it would breaks and give me a blank page. Any ideas on how to fix this issues? :( Here is the link to the phpinfo on my server. http://www.litewarehouse.com/phpinfo.php It is showing cURL is enabled with libcurl/7.10.5 OpenSSL/0.9.7b zlib/1.1.4 Any help would be greatly appreciated. Thanks -Tuan <?php // FIND BOOKS ON PHP AND MYSQL ON AMAZON $url = "http://www.amazon.com/exec/obidos/search-handle-form/002-5640957-2809605"; $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s curl_setopt($ch, CURLOPT_POST, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS, "url=index%3Dbooks&field-keywords=PHP+MYSQL"); // add POST fields $result = curl_exec($ch); // run the whole process curl_close($ch); echo $result; ?> Link to comment Share on other sites More sharing options...
Austin519 Posted March 25, 2004 Share Posted March 25, 2004 Tuan Le: It's great to see you made headway with this, even if you haven't found a solution yet. I will in the next few minutes add a new version of Authorize.net Consolidated to the contribution page you may want to check out. It doesn't sound like this is an issue with Windows 2003 in general anymore, but more with Windows 2003 and SSL. If you find a solution or anything I can update in the code to make it work better for you guys let me know. Austin519 Link to comment Share on other sites More sharing options...
Tuan Le Posted March 25, 2004 Author Share Posted March 25, 2004 I finally got it to work under Windows 2003 server. It turned out that an addtional line of code is needed. IT WILL NOT WORK WITHOUT THIS LINE OF CODE. This line of code is highlighted in bold below. :D $url = "https://secure.authorize.net/gateway/transact.dll"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $authorize = curl_exec($ch); curl_close ($ch); $response = split(",", $authorize); Link to comment Share on other sites More sharing options...
Austin519 Posted March 25, 2004 Share Posted March 25, 2004 Tuan Le: Okay...good to hear. Is this just a Windows 2003 thing, or will it be okay to add this line in a Linux server as well? And I assume using the binary method for cURL didn't work? Austin519 Link to comment Share on other sites More sharing options...
Tuan Le Posted March 25, 2004 Author Share Posted March 25, 2004 That is just for Windows 2003 only. It works like a charm as soon as I added that line. :D Link to comment Share on other sites More sharing options...
Austin519 Posted March 25, 2004 Share Posted March 25, 2004 Tuan Le: So will it have any impact on Linux users? It doesn't look like it will so I may just add it in permanently... Austin519 Link to comment Share on other sites More sharing options...
dolphin_dude Posted March 26, 2004 Share Posted March 26, 2004 I've been having a rough time getting the AIM module to work under IIS 5/Win2K. I had been getting the following error message: "There was an unspecified error processing your credit card." I added the line of code Tuan Lee suggested now I'm getting: "There was an error processing your credit card ():" Which feels like progress but I'm still VERY unsure to why I'm having this problem. Any clues? Also, I saw the posting (date stamped Mar 25, 6:52 am) about an update to the module being posted in the next couple of minutes. I looked under the "Authorize.net Consolidated v.1.0 for AIM" contribution and still just see the Feb 28 posting. TIA Link to comment Share on other sites More sharing options...
Austin519 Posted March 26, 2004 Share Posted March 26, 2004 dolphin_dude: Yeah my bad on that...the contrib update has been delayed because I found a bug in the code and I'm waiting on the guy who wrote the snippet I incorporated to reply. As for the errors, the first occurs when cURL isn't working, so that's good that's gone. The second is a general error, and Authorize.net should have returned info to you, namely there should be a number between those parenthesis and a message after it. If there's not...well that's weird...Authorize.net must not be replying to you with a specific error code, which is weird. I'd call them and see what they see. Austin519 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.