Ryan R 0 Posted August 22, 2011 Report Share Posted August 22, 2011 Hi all, I have tested the coffee e-commerce on my local computer after finishing the final.html file. My local php version 5.3.5 and mysql version 5.5.8 Unfortunately, I am having some errors when I try to go through the transaction part. After clicking "Place order" on billing.php, I saw error message "Fatal error: Call to undefined function curl_init() in C:\xampp\private\gateway_process.php on line 45" I will present the gateway_process.php below:(The line in bold is a problem line") ------------------------------------------------------------------------------------------------------------------------------------------------------ <?php // This script makes the actual request of the payment gateway. // Authorize.net URLs: if ($live) { define ('GATEWAY_API_URL', 'https://secure.authorize.net/gateway/transact.dll'); } else { define ('GATEWAY_API_URL', 'https://test.authorize.net/gateway/transact.dll'); } // Your account info: $data['x_login'] = '6m8yNMYY27'; $data['x_tran_key'] = '3Y5a3rEsxj2u6T7D'; // AIM Stuff: $data['x_version'] = '3.1'; $data['x_delim_data'] = 'TRUE'; $data['x_delim_char'] = '|'; $data['x_relay_response'] = 'FALSE'; // Transaction stuff: $data['x_method'] = 'CC'; // Order info: $data['x_amount'] = $order_total; $data['x_invoice_num'] = $order_id; $data['x_cust_id'] = $customer_id; // For testing purposes: // $data['x_test_request'] = 'TRUE'; // $data['x_amount'] = 6.00; // Convert the data: $post_string = ''; foreach( $data as $k => $v ) { $post_string .= "$k=" . urlencode($v) . "&"; } $post_string = rtrim($post_string, '& '); // This sample code uses the CURL library for php to establish a connection, // submit the post, and record the response. // If you receive an error, you may want to ensure that you have the curl // library enabled in your php configuration $request = curl_init(GATEWAY_API_URL); // initiate curl object curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1) curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response. $response = curl_exec($request); // execute curl post and store results in $post_response curl_close ($request); // close curl object // This line takes the response and breaks it into an array using the specified delimiting character $response_array = explode($data["x_delim_char"],$response); ------------------------------------------------------------------------------------------------------------------- Thanks for your help and look forward to hearing from you soon. Quote Link to post Share on other sites
Stuart 68 Posted August 22, 2011 Report Share Posted August 22, 2011 You don't have the CURL extension enabled - run phpinfo() to clarify. Quote Link to post Share on other sites
Ryan R 0 Posted August 22, 2011 Author Report Share Posted August 22, 2011 Thanks for your info. I am using xampp 1.7.4. and I enabled the curl by uncommenting the line: extension=php_curl.dll in xampp/php/php.ini-development and xampp/php/php.ini.production. And restarted Apache. However, it still doesn't work.. Did I make a mistake on uncommenting?? Thank you for your help again and look forward to hearing from you soon. Quote Link to post Share on other sites
Larry 429 Posted August 22, 2011 Report Share Posted August 22, 2011 Did you rerun a phpinfo() function to confirm that cURL was now enabled? Quote Link to post Share on other sites
Ryan R 0 Posted August 22, 2011 Author Report Share Posted August 22, 2011 I couldn't find the curl section on phpinfo. But I found php.ini and uncomment extension=php_curl.dll. I thought I needed to fix php.ini-production and php.ini-development files. Now, it's working well. Thanks for your help and effort. Strangely, my phpinfo() doesn't show you curl information. If you install xampp 1.7.4 on your computer and execute phpinfo(), you will see. Thanks again for your help. Quote Link to post Share on other sites
Jonathon 255 Posted August 22, 2011 Report Share Posted August 22, 2011 There are several php.ini files in XAMPP, you need to find which php.ini is loaded, which is present on the phpinfo() call. Then you know which one to alter Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.