Example #1
0
		$extfname = getcwd() . "/modules/tclink.so";
		echo "TCLink extension not loaded, attempting to load manually from $extfname...";

		// The excessive "../" bit allows us to back up out of the extension dir
		// so that we can access the current working directory.  It is only done
		// this way so that tctest.php may work out of the box on any system, you
		// can get rid of this if you do a global install of TCLink.
		$extfname = "../../../../../../../../../../../.." . $extfname;
		if (!dl($extfname)) {
			echo "FAILED!\nAborting this test script, please check to make sure the module is properly built.\n";
			exit(1);
		}
		echo "success.\n";
	}

	print "\nTCLink version " . tclink_getversion() . "\n";
	print "Sending transaction...";

	// Build a hash containing our parameters
	$params['custid'] = 'TestMerchant';
	$params['password'] = '******';
	$params['action'] = 'sale';
	$params['media'] = 'cc';
	$params['cc'] = '4111111111111111';
	$params['exp'] = '0110';
	$params['amount'] = '100';
	$params['name'] = 'Joe PHP';

	// Send the hash to TrustCommerce for processing
	$result = tclink_send($params);
Example #2
0
	if (!$custid) $custid = "TestMerchant";
	if (!$password) $password = "******";
?>
<html>
<head><title>TCLink PHP Example</title></head>
<body bgcolor=white text=black>

	<form method="post" action="<?php 
echo $PHP_SELF;
?>
">

	<table cellspacing=1 cellpadding=3>
	<tr bgcolor=blue><th colspan=2 align=center>
		<font color=white>TrustCommerce PHP Example - TCLink ver. <?php 
echo tclink_getversion();
?>
)</font>
	</th></tr>

	<tr><th align=right> CustID: </td><td> <input type="text" name="custid" value="<?php 
echo $custid;
?>
"> </td></tr>
	<tr><th align=right> Password: </td><td> <input type="text" name="password" value="<?php 
echo $password;
?>
"> </td></tr>
	<tr><th align=right> Action: </td><td> <select name="action">
		<option value="sale">Sale</option>
		<option value="preauth">Pre-Authorization</option>