steward dondi Posted February 20, 2008 Posted February 20, 2008 Using CURL to Connect Using HTTPS Print this ArticleComment on this Article Last Updated: January 29, 2008 3:42 PM Tell us what you think! Email*: Reason*: Inaccurate Missing Information Good, But Could be Better Other (Please Explain Below) Suggestion*: Hide Below is a PHP script that uses CURL to connect securely to a remote system (http://www.paypal.com), obtain data from that system and then creates a Web page based on that data. Note: On our shared hosting, any CURL applications that make secure HTTP connections (HTTPS over port 443) need to pass through a proxy server. The address for this proxy server is proxy.shr.secureserver.net and connections must specify the use of port 3128. The code below already includes this information. <? $URL="https://www.paypal.com"; if (isset($_GET["site"])) { $URL = $_GET["site"]; } $ch = curl_init(); echo "URL = $URL <br>n"; curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE); curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); curl_setopt ($ch, CURLOPT_PROXY,"http://proxy.shr.secureserver.net:3128"); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_URL, $URL); curl_setopt ($ch, CURLOPT_TIMEOUT, 120); $result = curl_exec ($ch); echo "<hr><br>n"; echo 'Errors: ' . curl_errno($ch) . ' ' . curl_error($ch) . '<br><br>'; echo "<hr><br>n"; curl_close ($ch); print "result - $result"; echo "<hr><br>n"; ?> I saw this on contributions as well for fastranact: VELOCT Direct Mode Module This is the payment module for VELOCT, FastTransact's Payment Gateway (www.fasttransact.com).<br><br> It uses direct mode to connect to the gateway so make sure to have Curl installed.<br><br> If you have any problems or questions please email me at [email protected] Expand All / Collapse All Ports 1401 and 1402 joshhulbert 1 Aug 2007 If you are hosting your oscommerce store on a hosting provider who does not allow traffic out on ports 1401 and/or 1402, consider the following modifications: // BEGIN PHP_CURL.DLL CODE - Author: Peter Drake - 4/29/03 // Use for Win32 or Unix-type systems with php-curl.dll // Get a CURL handle $curl_handle = curl_init(); // Tell CURL the URL of the CGI $URL="https://secure-dm3.ezic.com:443/gw/sas/direct3.1"; curl_setopt ($curl_handle, CURLOPT_VERBOSE, 1); curl_setopt ($curl_handle, CURLOPT_HTTPPROXYTUNNEL, TRUE); curl_setopt ($curl_handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); curl_setopt ($curl_handle, CURLOPT_PROXY,"http://proxy.shr.secureserver.net:3128"); curl_setopt ($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($curl_handle, CURLOPT_URL, $URL); curl_setopt ($curl_handle, CURLOPT_TIMEOUT, 120); // This section sets various options. See http://www.php.net/manual/en/function.curl-setopt.php // for more details curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data); curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, 0); // Perform the POST and get the data returned by the server. $response = curl_exec ($curl_handle) or die ("There has been an error connecting to VELOCT."); // Close the CURL handle curl_close ($curl_handle); //END PUP_CURL.DLL CODE This should help somewhat and I'm still working on getting my sight straight because I get that blank screen when I try to checkout, I think this is the reason, will report back if it is add your thoughts too. sincerely, Steward
Recommended Posts
Archived
This topic is now archived and is closed to further replies.