Skip to content
This repository was archived by the owner on Jun 3, 2022. It is now read-only.

Commit 5b95244

Browse files
committed
Release ccfd-api-php 1.47
0 parents  commit 5b95244

10 files changed

+1387
-0
lines changed

COPYING

+504
Large diffs are not rendered by default.

Changes

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Revision history for MaxMind CreditCardFraudDetection PHP API
2+
3+
1.47 April 25th 2008
4+
- Changed license from GPL to LGPL
5+
6+
1.46 October 4th 2007
7+
- Replaced www.maxmind.com and www2.maxmind.com with minfraud1.maxmind.com and minfraud2.maxmind.com
8+
9+
1.43 October 3rd 2006
10+
- Added support for new input fields, usernameMD5 and passwordMD5
11+
- Changed require ("HTTPBase.php") to require_once ("HTTPBase.php")
12+
in case both CCFD and Telephone Verification files are used (Mike Mallinson)
13+
14+
1.4 August 8th 2005
15+
- Added support for Telephone Verification
16+
- Use POST method instead of GET method, fixes bug where query string
17+
was truncated
18+
- Added support for bypassing DNS using IP addresses
19+
- Added shipCity shipRegion shipPostal shipCountry to list of input fields
20+
21+
1.3 February 9th 2005
22+
- Added requested_type, forwardedIP, emailMD5, shipAddr,
23+
txnID, sessionID to list of input fields
24+
- Added LocationVerification.php
25+
- Replaced global variables with class fields (David Recordon)
26+
27+
1.2 July 2nd 2004
28+
- Added binName, binPhone, custPhone to list of input fields
29+
30+
1.1 June 8th 2004
31+
- Replaced h1 and h2 servers with www and www2 (all ending with maxmind.com)
32+
- Fixed URL encoding bug
33+
- Fixed curl code
34+
- Added debug and timeout options
35+
- Failover if score field not set
36+
37+
1.0 May 5st 2004
38+
- original version

CreditCardFraudDetection.php

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?php
2+
3+
/* CreditCardFraudDetection.php
4+
*
5+
* Copyright (C) 2008 MaxMind, Inc.
6+
*
7+
* This library is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU Lesser General Public
9+
* License as published by the Free Software Foundation; either
10+
* version 2.1 of the License, or (at your option) any later version.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20+
*/
21+
22+
require_once ("HTTPBase.php");
23+
class CreditCardFraudDetection extends HTTPBase {
24+
var $server;
25+
var $numservers;
26+
var $API_VERSION;
27+
28+
function CreditCardFraudDetection() {
29+
$this->HTTPBase();
30+
$this->isSecure = 1; // use HTTPS by default
31+
32+
//set the allowed_fields hash
33+
$this->allowed_fields["i"] = 1;
34+
$this->allowed_fields["domain"] = 1;
35+
$this->allowed_fields["city"] = 1;
36+
$this->allowed_fields["region"] = 1;
37+
$this->allowed_fields["postal"] = 1;
38+
$this->allowed_fields["country"] = 1;
39+
$this->allowed_fields["bin"] = 1;
40+
$this->allowed_fields["binName"] = 1;
41+
$this->allowed_fields["binPhone"] = 1;
42+
$this->allowed_fields["custPhone"] = 1;
43+
$this->allowed_fields["license_key"] = 1;
44+
$this->allowed_fields["requested_type"] = 1;
45+
$this->allowed_fields["forwardedIP"] = 1;
46+
$this->allowed_fields["emailMD5"] = 1;
47+
$this->allowed_fields["shipAddr"] = 1;
48+
$this->allowed_fields["shipCity"] = 1;
49+
$this->allowed_fields["shipRegion"] = 1;
50+
$this->allowed_fields["shipPostal"] = 1;
51+
$this->allowed_fields["shipCountry"] = 1;
52+
$this->allowed_fields["txnID"] = 1;
53+
$this->allowed_fields["sessionID"] = 1;
54+
$this->allowed_fields["usernameMD5"] = 1;
55+
$this->allowed_fields["passwordMD5"] = 1;
56+
57+
$this->num_allowed_fields = count($this->allowed_fields);
58+
59+
//set the url of the web service
60+
$this->url = "app/ccv2r";
61+
$this->check_field = "score";
62+
$this->server = array("minfraud1.maxmind.com", "minfraud2.maxmind.com");
63+
$this->numservers = count($this->server);
64+
$this->API_VERSION = 'PHP/1.43';
65+
}
66+
67+
function filter_field($key, $value) {
68+
if ($key == 'emailMD5'){
69+
if (ereg('\@',$value)){
70+
return md5(strtolower($value));
71+
}
72+
} else if ($key == 'usernameMD5' || $key == 'passwordMD5') {
73+
if (strlen($value) != 32) {
74+
return md5(strtolower($value));
75+
}
76+
}
77+
return $value;
78+
}
79+
}
80+
?>

Example.php

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/usr/bin/php -q
2+
<?php
3+
require("CreditCardFraudDetection.php");
4+
5+
// Create a new CreditCardFraudDetection object
6+
$ccfs = new CreditCardFraudDetection;
7+
8+
// Set inputs and store them in a hash
9+
// See http://www.maxmind.com/app/ccv for more details on the input fields
10+
11+
// Enter your license key here (Required)
12+
$h["license_key"] = "YOUR_LICENSE_KEY_HERE";
13+
14+
// Required fields
15+
$h["i"] = "24.24.24.24"; // set the client ip address
16+
$h["city"] = "New York"; // set the billing city
17+
$h["region"] = "NY"; // set the billing state
18+
$h["postal"] = "11434"; // set the billing zip code
19+
$h["country"] = "US"; // set the billing country
20+
21+
// Recommended fields
22+
$h["domain"] = "yahoo.com"; // Email domain
23+
$h["bin"] = "549099"; // bank identification number
24+
$h["forwardedIP"] = "24.24.24.25"; // X-Forwarded-For or Client-IP HTTP Header
25+
// CreditCardFraudDetection.php will take
26+
// MD5 hash of e-mail address passed to emailMD5 if it detects '@' in the string
27+
$h["emailMD5"] = "[email protected]";
28+
// CreditCardFraudDetection.php will take the MD5 hash of the username/password if the length of the string is not 32
29+
$h["usernameMD5"] = "test_carder_username";
30+
$h["passwordMD5"] = "test_carder_password";
31+
32+
// Optional fields
33+
$h["binName"] = "MBNA America Bank"; // bank name
34+
$h["binPhone"] = "800-421-2110"; // bank customer service phone number on back of credit card
35+
$h["custPhone"] = "212-242"; // Area-code and local prefix of customer phone number
36+
$h["requested_type"] = "premium"; // Which level (free, city, premium) of CCFD to use
37+
$h["shipAddr"] = "145-50 157TH STREET"; // Shipping Address
38+
$h["shipCity"] = "Jamaica"; // the City to Ship to
39+
$h["shipRegion"] = "NY"; // the Region to Ship to
40+
$h["shipPostal"] = "11434"; // the Postal Code to Ship to
41+
$h["shipCountry"] = "US"; // the country to Ship to
42+
43+
$h["txnID"] = "1234"; // Transaction ID
44+
$h["sessionID"] = "abcd9876"; // Session ID
45+
46+
// If you want to disable Secure HTTPS or don't have Curl and OpenSSL installed
47+
// uncomment the next line
48+
// $ccfs->isSecure = 0;
49+
50+
// set the timeout to be five seconds
51+
$ccfs->timeout = 5;
52+
53+
// uncomment to turn on debugging
54+
// $ccfs->debug = 1;
55+
56+
// how many seconds to cache the ip addresses
57+
// $ccfs->wsIpaddrRefreshTimeout = 3600*5;
58+
59+
// file to store the ip address for minfraud1.maxmind.com and minfraud2.maxmind.com
60+
// $ccfs->wsIpaddrCacheFile = "/tmp/maxmind.ws.cache";
61+
62+
// if useDNS is 1 then use DNS, otherwise use ip addresses directly
63+
$ccfs->useDNS = 0;
64+
65+
$ccfs->isSecure = 0;
66+
67+
// next we set up the input hash
68+
$ccfs->input($h);
69+
70+
// then we query the server
71+
$ccfs->query();
72+
73+
// then we get the result from the server
74+
$h = $ccfs->output();
75+
76+
// then finally we print out the result
77+
$outputkeys = array_keys($h);
78+
$numoutputkeys = count($h);
79+
for ($i = 0; $i < $numoutputkeys; $i++) {
80+
$key = $outputkeys[$i];
81+
$value = $h[$key];
82+
print $key . " = " . $value . "\n";
83+
}
84+
?>

Example_locv.php

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/php -q
2+
<?php
3+
require("LocationVerification.php");
4+
5+
//first we create a new CreditCardFraudDetection object
6+
$locv = new LocationVerification;
7+
8+
//Enter your license key here
9+
// $h["license_key"] = "YOUR_LICENSE_KEY_HERE";
10+
11+
// Set inputs and store them in a hash
12+
13+
// Required fields
14+
$h["i"] = "24.24.24.24"; // set the client ip address
15+
$h["city"] = "New York"; // set the billing city
16+
$h["region"] = "NY"; // set the billing state
17+
$h["postal"] = "10011"; // set the billing zip code
18+
$h["country"] = "US"; // set the billing country
19+
20+
// If you want to disable Secure HTTPS or don't have Curl and OpenSSL installed
21+
// uncomment the next line
22+
// $locv->isSecure = 0;
23+
24+
// how many seconds to cache the ip addresses
25+
$locv->wsIpaddrRefreshTimeout = 3600*5;
26+
// file to store the ip address
27+
$locv->wsIpaddrCacheFile = "/tmp/maxmind.ws.cache";
28+
// if useDNS is 1 then use DNS, otherwise use ip addresses directly
29+
// $locv->useDNS = 1;
30+
31+
// set the time out to be five seconds
32+
$locv->timeout = 5;
33+
34+
// uncomment to turn on debugging
35+
$locv->debug = 1;
36+
37+
// next we set up the input hash
38+
$locv->input($h);
39+
40+
// then we query the server
41+
$locv->query();
42+
43+
// then we get the result from the server
44+
$h = $locv->output();
45+
46+
// then finally we print out the result
47+
$outputkeys = array_keys($h);
48+
$numoutputkeys = count($h);
49+
for ($i = 0; $i < $numoutputkeys; $i++) {
50+
$key = $outputkeys[$i];
51+
$value = $h[$key];
52+
print $key . " = " . $value . "\n";
53+
}
54+
?>

Example_telv.php

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/php -q
2+
<?php
3+
require("TelephoneVerification.php");
4+
5+
$tv = new TelephoneVerification;
6+
7+
// Set inputs and store them in a hash
8+
// See http://www.maxmind.com/app/telephone_form for more details on the input fields
9+
10+
// Enter your license key here
11+
// $h["l"] = "YOUR_LICENSE_KEY_HERE";
12+
13+
// Enter your telephone number here
14+
// $h["phone"] = "YOUR_TELEPHONE_NUMBER_HERE";
15+
16+
// $h["verify_code"] = "5783";
17+
18+
// If you want to disable Secure HTTPS or don't have Curl and OpenSSL installed
19+
// uncomment the next line
20+
// $tv->isSecure = 0;
21+
22+
//set the time out to be 30 seconds
23+
$tv->timeout = 30;
24+
25+
//uncomment to turn on debugging
26+
// $tv->debug = 1;
27+
28+
//how many seconds the cache the ip addresses
29+
$ccfs->wsIpaddrRefreshTimeout = 3600*5;
30+
31+
//where to store the ip address
32+
$ccfs->wsIpaddrCacheFile = "/tmp/maxmind.ws.cache";
33+
34+
// if useDNS is 1 then use DNS, otherwise use ip addresses directly
35+
$ccfs->useDNS = 0;
36+
37+
// next we set up the input hash to be passed to the server
38+
$tv->input($h);
39+
40+
// then we query the server
41+
$tv->query();
42+
43+
// then we get the result from the server
44+
$h = $tv->output();
45+
46+
//then finally we print out the result
47+
$outputkeys = array_keys($h);
48+
$numoutputkeys = count($h);
49+
for ($i = 0; $i < $numoutputkeys; $i++) {
50+
$key = $outputkeys[$i];
51+
$value = $h[$key];
52+
print $key . " = " . $value . "\n";
53+
}
54+
?>

0 commit comments

Comments
 (0)