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
PHP Web Logs (BLogs)
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
Submit Site
Forex Trading Online forex trading platform

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 : 15785
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
Authorize.net AIM Interface Class v1.0.0
Categories : PHP, PHP Classes, Ecommerce, Payment Gateways
PHP-MySQL shopping cart
Categories : PHP, Ecommerce, Complete Programs
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
an example of the cyberlib payment class
Categories : PHP, PHP Classes, Ecommerce, Credit Cards
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
phpAds, a complete banner and ad management system with detailled tracking and stats.
Categories : MySQL, Complete Programs, Ecommerce, PHP, Databases
PHPCatalog
Categories : Ecommerce, PHP, Complete Programs
Shopping Basket On-Line Ordering System.
Categories : Complete Programs, MySQL, PHP, Ecommerce, Databases
shopping cart class with add/edit/delete product functionality.
Categories : PHP, PHP Classes, Ecommerce
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
Simple Mini Poll class library (SimPoll)
Categories : PHP, PHP Classes, Databases, MySQL, Complete Programs
This is a redirection program which is as good as the come.to v3 url redirection, complete with admin interface all clients stored in mysql
Categories : PHP, MySQL, Ecommerce, HTML and PHP, Complete Programs
Client classes for Dictionary servers UPDATED: 2000-06-06
Categories : Network, Search, Complete Programs, PHP Classes, PHP
DBE - Database Expander: Edit PostgreSQL individual database tables online via your Web browser!
Categories : PostgreSQL, Complete Programs, Databases, PHP Classes, PHP
  wrote :235
Has anyone gotten this thing to work?