WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : a class for doing payments to a cybercash server
Categories : Ecommerce, Complete Programs, PHP Classes, PHP Update Picture
Timothy Whitfield
Date : Jan 17th 1999
Grade : 3 of 5 (graded 8 times)
Viewed : 17294
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Timothy Whitfield
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?
class payment
{
var $name, $street, $city, $state, $zip, $country;
var $type, $merchant_secret;
var $card_no, $card_exp;

/*Construction*/
var $method= "POST";
var $host= "localhost";
var $port=8000;
var $http_version= "HTTP/1.0";
var $type= "mauthonly";
/*End Construction*/

function make_content($order_no, $amount)
{
$content= "order-id="+(string)$order_no+ "&";
$content=$content+ "amount=usd+"+$amount+ "&";
$content=$content+ "card-number="+$this->card_no+ "&";
$content=$content+ "card-name="+$this->name+ "&";
$content=$content+ "card-address="+$this->street+ "&";
$content=$content+ "card-city="+$this->city+ "&";
$content=$content+ "card-state="+$this->state+ "&";
$content=$content+ "card-zip="+$this->zip+ "&";
$content=$content+ "card-exp="+$this->card_exp+ "&";
$content=$content+ "card-country="+$this->country;

return $content;
}

function make_request($order_no, $amount)
{
$content=$this->make_content($order_no, $amount);

$content=ereg_replace( " ", "\\+",$content);
$content_length=(string)strlen($content);
$req=$this->method;
$req=$req+ " /"+$this->merchant_secret+ "/"+$this->type;
$req=$req+ " "+$this->http_version+ "\\r\\n";

$req=$req+ "User-Agent: CyberCashMerchant-2.1.4\\r\\n";
$req=$req+ "Content-Type: application/x-www-form-
urlencoded\\r\\n";
$req=$req+ "Content-Length: "+$content_length+ "\\r\\n\\r\\n";
$req=$req+$content+ "\\r\\n\\r\\n";

return $req;
}

function send($order_no, $amount)
{
$req=$this->make_request($order_no, $amount);
$fd=fsockopen($this->host,$this->port);

if($fd<0)
return "Error contacting cash register server.
\\n";

fputs($fd,$req);

/* Retrieve header. */
$i=0;
$response= "";
while(!feof($fd) && $response != "\\n")
{
$response= "";
$more= "";
while(!feof($fd) && $more != "\\n")
{
$more=fgets($fd,2);
if($more != "\\n" || $response== "")
{
$response=$response+$more;
}
}
$header[$i++]=$response;
}

/* Retrieve variables. */
$response= "";
$more= "";
while(!feof($fd) && $more != "\\n")
{
$more= "";
$type= "var";
$varname= "";
$varval= "";
while(!feof($fd) && $more != "&" && $more !=
"\\n")
{
$more=fgets($fd,2);
if($more != "&" && $more != "=" &&
$more != "\\n")
{
$response=$response+$more;
}
if($more== "=")
{
$varval=ereg_replace( "\\+", " ",
$response);
$response= "";
}
if($more== "&" || $more== "\\n")
{
$varval=$response;
$response= "";
}
}
if($varname != "")
{
$cybervar[$varname]=$varval;
}
}

return $cybervar;
}
};
?>



simple shopping cart for php3
Categories : PHP, PHP Classes, Complete Programs, Ecommerce
Client classes for Dictionary servers UPDATED: 2000-06-06
Categories : Network, Search, Complete Programs, PHP Classes, PHP
Authorize.net AIM Interface Class v1.0.0
Categories : PHP, PHP Classes, Ecommerce, Payment Gateways
shopping cart class with add/edit/delete product functionality.
Categories : PHP, PHP Classes, Ecommerce
Credit Card Identification and Validation Class - The credit_card class provides methods for cleaning, validating and identifying the type of credit card numbers.
Categories : PHP, PHP Classes, Credit Cards, Ecommerce, Algorithms
Example Shopping cart class
Categories : Ecommerce, PHP, PHP Classes
PHP-MySQL shopping cart
Categories : PHP, Ecommerce, Complete Programs
Create and restore backup of MySQL databases
Categories : MySQL, Databases, PHP, PHP Classes, Complete Programs
DBE - Database Expander: Edit PostgreSQL individual database tables online via your Web browser!
Categories : PostgreSQL, Complete Programs, Databases, PHP Classes, PHP
Expose - PHP template engine, supports server and client-sided caching,a plugin system, multiple languages, template script language is based on PHP itself.
Categories : PHP, PHP Classes, Templates, Complete Programs
phpAds, a complete banner and ad management system with detailled tracking and stats.
Categories : MySQL, Complete Programs, Ecommerce, PHP, Databases
ClassFuncDoc - This script is a classes and functions documentation tool.
Categories : PHP, Classes and Objects, Documentation, PHP Classes, Complete Programs
Cool guestbook
Categories : PHP, Complete Programs, PHP Classes
REALTIME SHIPPING QUOTE
Categories : Complete Programs, Ecommerce, PHP
ECHO-PHP Class Real Time Transaction Processor v1.4.4 for Credit Cards and Checks / ACH
Categories : PHP Classes, Cybercash, Classes and Objects, Ecommerce, PHP
  wrote :235
Has anyone gotten this thing to work?