Archive for December 2006
links for 2006-12-30
-
plaintext always wins
-
more commonly called the unabomber’s manifesto
-
interesting piece about the 1996 olympic bomber, in the same prison as the unabomber and terry nichols (oklahoma city bombing) “The plan was to force the cancellation of the Games, or at least create a state of insecurity to empty the streets around the v
-
“To regain it, he challenged Howell to a contest to raise the dead, even digging up one corpse to practice on it” – Howell changed his name to David Koresh. Wow.
-
“In order to avoid offending religious fundamentalists, our National Park Service is under orders to suspend its belief in geology,” stated PEER Executive Director Jeff Ruch. “It is disconcerting that the official position of a national park as to t
-
“Soda Popinski made his first appearance in the arcade as the ‘Champion of the USSR’ in the 1984 game Super Punch-Out!!; although back then he was known under the less politically-correct name of Vodka Drunkenski. “
-
I’m going to start backing up my gmail after reading about the mass deletion scares.
links for 2006-12-30
-
-
Great post on PHP and why it’s going to be one of the languages that sticks around.
-
I want to do this in mid June.
-
-
awesome new mod of campaigning. it will be interesting watching the competition.
-
plaintext always wins
-
more commonly called the unabomber’s manifesto
-
interesting piece about the 1996 olympic bomber, in the same prison as the unabomber and terry nichols (oklahoma city bombing) “The plan was to force the cancellation of the Games, or at least create a state of insecurity to empty the streets around the v
-
“To regain it, he challenged Howell to a contest to raise the dead, even digging up one corpse to practice on it” – Howell changed his name to David Koresh. Wow.
-
“In order to avoid offending religious fundamentalists, our National Park Service is under orders to suspend its belief in geology,” stated PEER Executive Director Jeff Ruch. “It is disconcerting that the official position of a national park as to t
-
“Soda Popinski made his first appearance in the arcade as the ‘Champion of the USSR’ in the 1984 game Super Punch-Out!!; although back then he was known under the less politically-correct name of Vodka Drunkenski. “
-
I’m going to start backing up my gmail after reading about the mass deletion scares.
links for 2006-12-29
-
-
Great post on PHP and why it’s going to be one of the languages that sticks around.
-
I want to do this in mid June.
-
-
awesome new mod of campaigning. it will be interesting watching the competition.
Phasing out the Linkrolls
Instead of having the linkrolls take up the huge chunk of real-estate on each page, I’m experimenting with delicious’ XML-RPC posting interface.
I’ll let you know how it goes =)
Let’s go Skydiving (clap clap-clapclapclap)
I came across the Kentucky Skydiving Center on Google today. When I was in KC I really wanted to try some Skydiving. I’ll give it a try now that I’m back in KY.
I’d really like to wait until later in the year – maybe coordinate some other readers/friends to go along, too. None of that tandem business, though. I want to solo jump. Prices:
- $129
- $Gas to Drive to Frankfort
- $66 for a video (which would obviously be posted to YouTube!)
Anyone want to go?
Authorizing and Capturing Credit Card Transactions with Authorize.net and PHP/MySQL
This is a quick guide intended for anyone who wants to make some money online. I will be covering the Authorize.net Advanced Integration Method (AIM) which is fully documented elsewhere. Their documentation is excellent, but it does little for PHP/MySQL.
Things you will need:
- A server with PHP/MySQL and cURL
- An Authorize.net merchant account. Not a Merchant? Contact Authorize.
- An SSL certificate on the server you’re using
- A basic understanding of PHP and cURL
Step 0: Terminology
- Validate – before we go out and hit Authorize.net we need to make every effort to ensure the data we sent them is valid. This involves basic input validation and taking the credit card number through what is called the Luhn algorithm (wikipedia link contains a sample PHP function)
- Authorize – verify that the card could be charged for an amount.
- Capture – actually charge the card a specified amount.
- Transaction – completion of at least the authorization step
- PCI Compliance – PCI stands for Payment Cardholder Institute. It’s basically a consortium of American Express, JCB, MasterCard, and VISA International who have set forth security guidelines that developers must be privvy to in order to legally store customer payment data.
Step 1: Preparing the Data
The required fields for a successful Authorize.net Credit Card transaction are:
- x_login (constant, authorize.net will provide this)
- x_tran_key (constant, authorize.net will provide this)
- x_delim_data (x_delim_char, x_encap_char) – you can specify how Authorize.NET returns data to you. The delimiting character I used was ”|” and the encapsulating characters I used were “”. So my data would look like: “1”|”The transaction was approved.”
- x_amount – an amount. No dollar sign. 00.00
- x_method – set this to “CC”.
- x_type – Defaults to AUTH_CAPTURE. Depending on your business needs you may/may not want to Authorize and Capture on the spot. Check the documentation for other settings.
- x_card_num – the Luhn validated credit card number.
- x_exp_date – card’s expiration date. A variety of formats will work. I’m partial to MM-YYYY. PHP date(“m-Y”, $exp_date).
- x_card_code – CVV code
You’ll want to gather all of this data into a POST string, like this one:
x_login=abc&x_tran_key=123…&x_card_code=234
This can be done a variety of ways in PHP. From an example gotten at Authorize.net:
$authnet_values= array
(
“x_login”=> $auth_net_login_id,
“x_version”=> “3.1″,
“x_delim_char”=> “|”,
“x_delim_data”=> “TRUE”,
“x_url”=> “FALSE”,
“x_type”=> “AUTH_CAPTURE”,
“x_method”=> “CC”,“x_tran_key”=> $auth_net_tran_key,
“x_relay_response”=> “FALSE”,
“x_card_num”=> “4242424242424242″,
“x_exp_date”=> “1203″,
“x_description”=> “Recycled Toner Cartridges”,
“x_amount”=> “12.23″,
“x_first_name”=> “Charles D.”,
“x_last_name”=> “Gaulle”,
“x_address”=> “342 N. Main Street #150″,
“x_city”=> “Ft. Worth”,
“x_state”=> “TX”,
“x_zip”=> “12345″,
);$fields = “”;
foreach( $authnet_values as $key => $value ) $fields .= “$key=” . urlencode( $value ) . “&”;
Step 2: Sending to Authorize.net
There are two URLs you can use to send to Authorize.net:
- https://certification.authorize.net/gateway/transact.dll – testing only
- https://secure.authorize.net/gateway/transact.dll – production only
The PHP:
$ch = curl_init(“https://certification.authorize.net/gateway/transact.dll”);
curl_setopt($ch, CURLOPT_HEADER, 0); // removes HTTP headers from response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns response data
curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim( $fields, “& ” )); // use HTTP POST to send form data
$authorize_response = curl_exec($ch); //execute post and get results
curl_close ($ch);
Testing the transactions can be a pain.
Here are some numbers to test your transactions with:
- Visa: 4111-1111-1111-1111
- MasterCard: 5431-1111-1111-1111
- Amex: 341-1111-1111-1111
- Discover: 6011-6011-6011-6611
Step 3: Parsing Authorize’s Response
Authorize.net will send back a response to you, stored in $authorize_response. It will vary depending on the delimiters you set up in your cURL request. It should look something like this:
“X”|”XXX”|”XX”|”XX”|”X”|”X”|”X”|”X”|”X”|”X”|”X”
Again, this string depends on what you sent to Authorize.NET via cURL. You’ll now want to make heavy use of PHP’s explode function and deal with what happens in your application when there is success, failure, or other errors.
The big one is the first field you receive back. It’s referred to as “ResponseCode”. There are three different ResponseCodes—1 = Approved, 2 = Declined, 3 = Error. After you receive a ResponseCode of 1—and only after that can you consider the transaction complete and start fulfilling the order.
Read up in the Authorize.net AIM documentation for more about response codes. – It’s under “Gateway Response API”.
Authorize.net also provides sample PHP code if you’re still having trouble.
See also…
Higher Level
Since moving back to my old Kentucky home, I’ve realized what I was missing when I was in KS – the time to do “higher level” activities.
Basically in KC here’s a summary of my activities:
- Work & Commute (35%) – 60 hours a week (very conservative estimate – especially when external projects were going on)
- Sleep (29%) – 7 hours a night (again, conservative estimate)
- Eat (8%) – 2 hours a day, including lunch break at work (an hour for lunch at work stretches it a little)
- Free Time (18%) – 4 hours a day – Includes watching LOST, driving to and from DMac’s, awesome times on the Malibu, TOOL/O.A.R./Thursday & Billy Talent concerts, bars, and Guitar Hero. 4 hours a day seems excessive, but remember I’m talking about a 7 day week. Weekends skew this number
Here’s a summary of my activities in KY so far:
- Work & Commute (23%) – 40.5 hours a week.
- Sleep (29%) – still about 7 hours a night.
- Eat (8%) – 2 hours a day. Mandatory one hour lunch, though.
- Free Time (39%) – 9 hours a day. This includes seeing friends, bars, cooking meals, watching TV, doing things around the apartment, reading
We’ve got a 11% increase in “Free Time” and an 11% decrease in “Work & Commute”.
Maybe some pies will help illustrate [click for full views]:
Kansas City:
Kentucky:
As the charts reveal, I clearly have more free time. Which means I can spend it doing “higher level” activities besides work/sleep/eat. What am I going to be doing?
- Reading
- Catching up with friends
- Making new friends
- Exercise
- Cooking/Learning to Cook more things
- The ever important, writing and making pie charts about my time to post on my blog =)
New Subscriptions
My new RSS subscriptions this week, using Google Reader:
- Products: woot
- Analytics: Analaytics Talk – GA Experts – Occams Razor
- Friends: evanelrod.com
- Interesting: PostSecret
- Me: TadaLists for andrew hill [private]
- PHP: Zend Developer Zone
- web: 9rules network official blog – Mo Jebus
Great sites with great advice. Any other suggestions?
New Music Suggestions
I’m in dire need of some good, new (to me) music.
Check my last.fm to see what I’ve been listening to if you don’t know what kind of music I’m into. I wouldn’t say my last.fm is too indicative of all of my musical tastes, but it’s a start.
Craiggers? Chris R? Bittel?
Comment me up some awesome new music, please!
The Other Regimen
Since I’ve moved life has slowed down dramatically. There are a few good things about this:
- I’m reading again
- I’m cooking again, thus I’m not eating out nearly as much
- I’m sleeping again
- I’m seeing family/friends again
The not so good things:
- (sometimes) I’m bored again
- I’m not going to Chipotle or QuikTrip
- I’m poor again
- I’m out of those “I’m too busy” excuses
The one thing that I want to get back into (more than anything in the world, Ron!) is an exercise regimen. My sister’s going to be my accountability partner with working out at the OMHS Health Park.
There’s more incentives than the whole “better feeling, better looking” that always goes with a healthier lifestyle. In an effort to reduce claims, my employer offers reductions in Health Insurance Premiums if you meet certain wellness requirements. Very cool.
Anyone out there have suggested recipes? Shaina & Rick Petersen, I’m talking to you particularly. =)