Once curl is installed, it's time to make the connection. Anacom offers
modules for direct connection via Perl, Java, and executables for Windows
NT, but not PHP --- so I wrote my own. Here is the function I use for
connecting to Anacom:
<XMP>
<?php
//////////////////////////////////////////////////////////
// PostAnacom.php
//
// a PHP function for connecting to Anacom and
// charging a credit card while returning the result
// to the calling script for reading and/or processng
//
//////////////////////////////////////////////////////////
// this function connects to Anacom and reads the result
function GetAnacomResult($fulltotal, $ordernumber,
$ccname, $baddress, $bcity,
$bstate, $bzip, $bcountry,
$bphone, $email, $trantype,
$username, $ccnumber, $month, $year)
{
// the UPGI version we are currently using
$version = "1.1";
// path to curl
$curl = "/usr/local/bin/curl";
// URL for posting to Anacom
$anacom_url
"https://www.payment-gateway.net/servlet/com.anacom.aai.Aai";
// build the data string that contains the
// credit card info and customer data
This is where the work is actually done. An exec call is made to curl and
the query string is passed to Anacom via the POST method. The result is read
in the variable $return_string. The variable $curl will need to point to the
location where curl lives.