Results 1 to 10 of 28

Hybrid View

  1. #1
    Join Date
    Dec 2007
    Posts
    3
    Plugin Contributions
    0

    Default Re: Error accessing Gateway -- Innovative Gateway module

    I found the problem. Godaddy says that all CURL traffic (if that is the right word) needs to go through a proxy server.

    I downloaded an example from the IG websitte, plugged in the proxy addy and got a response from the server.

    This is good news but also bad news, the payment module I linked to earlier wasn't written to support a proxy address. I've tried recoding it but I have absolutely no idea what I am doing and nothing worked obviously.

    I am sure this is very simple to a php coder. I've tried contacting the original developer by phone and email with no answer back.

    I have a feeling that this code is what needs to be changed but not 100% sure.

    -------------------------------

    // post the data

    $cmd = MODULE_PAYMENT_INNOVATIVE_CURL . " -d \"$data\" " . MODULE_PAYMENT_INNOVATIVE_URL;
    // echo "curl command<br>" . $cmd . "<br>";

    exec($cmd, $return_string);

    --------------------------------

    What would I have to do to support curl through a proxy. Following is the proxy part of the example code that IG gives that I used successfully.

    -------------------------------

    //--< GATEWAY/ISP OPTIONS >------------------

    $url = "https://transactions.innovativegateway.com/servlet/com.gateway.aai.Aai";
    $user_agent = "Mozilla/4.0";
    $proxy = "proxy.shr.secureserver.net:3128"; // If you use a proxy server to connect
    // your server to the Internet then put
    // in its address here.

    // Create the POST form to send to the gateway using
    // the incoming array.
    $data = "";
    foreach ($transaction as $name => $value) {
    $data .= "&" . $name . "=" . urlencode($value);
    }

    $data = substr($data,1);

    // Create the connection through the cURL extension
    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL, $url);

    if ($proxy != "")
    curl_setopt ($ch, CURLOPT_PROXY, $proxy);

    curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);
    curl_setopt ($ch, CURLOPT_POST, 1);
    curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
    $result = curl_exec ($ch);
    curl_close($ch);

    ------------------------------------------

    If anyone knows how to modify the payment module to use a proxy address like the example code immediately above, I am sure I wouldn't be the only one that could use this.

    Anyone's help in this would be greatly appreciated as I am totally lost.

  2. #2
    Join Date
    Apr 2008
    Posts
    24
    Plugin Contributions
    0

    Default Re: Error accessing Gateway -- Innovative Gateway module

    http://help.godaddy.com/article/289


    yes, you're right. note the changes i made below... connects for me now...


    Code:
    
    function PostTransaction ($transaction) {
    //	This function accepts one variable as an array.
    //	That array should contain all of the variables 
    //	required to connect to and authorized payments in
    //	the payment gateway.
    //
    //	You can create as many "object arrays" as you like
    //	and when ready send them through the PostTransaction()
    //	function to perform the appropriate action.
    
    //--< GATEWAY/ISP OPTIONS >------------------
    
    	$URL="https://transactions.innovativegateway.com/servlet/com.gateway.aai.Aai";
    	$user_agent = "Mozilla/4.0";
    	$proxy = ""; // If you use a proxy server to connect
    		     // your server to the Internet then put
    		     // in its address here.
    
    	// Create the POST form to send to the gateway using
    	// the incoming array.
    	$data = "";
    	foreach ($transaction as $name => $value) {
    	    $data .= "&" . $name . "=" . urlencode($value);
    	}
    
    	$data = substr($data,1);
    
    	// Create the connection through the cURL extension
            $ch = curl_init(); 
    
    	// if ($proxy != "")
    	// curl_setopt ($ch, CURLOPT_PROXY, $proxy); 
    
    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);
    
           	curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent); 
    	curl_setopt ($ch, CURLOPT_POST, 1);
    	curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
                    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
                    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
    
    //  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";
    
    	// Now we've got the results back in a big string.
    
    	// Parse the string into an array to return
    	$rArr = explode("|",$result);
    
    	$returnArr="";
    	for($i=0;$i<count($rArr);$i++)
    	{
    		$tmp2 = explode("=", $rArr[$i]);
    
    		// YES, we put all returned field names in lowercase
    		$tmp2[0] = strtolower($tmp2[0]);
    
    		// YES, we strip out HTML tags.
    		$returnArr[$tmp2[0]] = strip_tags($tmp2[1]);
    	}
    
    	// Return the array.
    	return $returnArr;
    }
    
    ?>

 

 

Similar Threads

  1. Innovative Gateway module
    By Micki711 in forum Addon Payment Modules
    Replies: 4
    Last Post: 24 Apr 2010, 06:17 AM
  2. Does Anyone Use Innovative Gateway Payment?
    By Micki711 in forum Addon Payment Modules
    Replies: 0
    Last Post: 14 Apr 2010, 01:39 PM
  3. Innovative gateway payment mod HELP
    By MULISH in forum Addon Payment Modules
    Replies: 0
    Last Post: 14 May 2009, 11:06 PM
  4. Innovative Gateway Needed Please Help
    By Little Haven in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 22 Nov 2006, 05:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg