The Shutdown of Google Reader is a Great Opportunity to Review Your News Feeds

With Google Reader being deactivated, I am reviewing the news feeds, newsletters, podcasts, and blogs that I read each day, but are not helpful, while also finding new ones that do add value.

In the book The Primal Connection they bring up studies that half of all news broadcasts are full of violence, conflict, and suffering. That watching these events can create feelings of anger, fear, and helplessness. I now find myself unsubscribing from news I have read for years or sites that have many updates per day that end up not really helping me in day to day life. Not just world or national news, but even sports and technology news I often have to wade through lots of useless junk to find things of interest.

Like the advice that you are the average of your 5 closest friends, is your online experience the average of your 5 favorite blogs?

I have been pleasantly surprised by the new blogs I have searched out. After unsubscribing from many things, I have found new gems that I never knew existed. This makes me look forward to reading my news feed much more, rather than the dread I felt wading though the junk I had in there before.

The closing of reader is a great opportunity to review what you consuming online and make sure it is helping you, rather than dragging you down.

Web Application Layers

There are so many layers involved in a web application that I decided to make my own representation of them because I could not find one I liked online.

Browser Presentation
(css, html, img)
Browser Language
Browser Client
(http, https)
Internet (ip, dns)
Web Server
(http, static files)
Server Language
(php, ruby, etc)
Database Server
(sql, api)

Skipjack PHP Example

I recently implemented card processing through the Skipjack service. Their documentation covers everything needed for integration, however they do not provide any example code. Here is some example code using PHP with Curl to send transaction files to their Batch processing service. You can also use Curl for single card transactions, however you are not sending a batch file and would probably want to timeout soon instead of waiting for the batch to finish.

// set variables unique to this connection and file paths
$HTMLSerialNumber = "123456789";
$outfile = "/path/to/my/file/BatchUploadDataAUTH";

// set the time limit for this script to infinity since a batch can take a while

// developer URL for skipjack
$sendurl = "";

// send the batch file to the skipjack batch gateway
$ch = curl_init();
$data = array('serialNumberAUTH' => $HTMLSerialNumber,
'batchType' => '0',
'BatchUploadDataAUTH' => '@'.$outfile);

curl_setopt($ch, CURLOPT_URL, $sendurl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); // wait forever
curl_setopt($ch, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)

$response = curl_exec($ch);
curl_close ($ch); // close curl object

// this will show the web page they send back that says upload successful
echo $response;

After this send process completes you can use Curl to check for the batch response and download the response file from their site.

When checking for the result or getting your response file you will also have to send data to Skipjack to tell them your serial numbers, the date you want to check, or the batch id you want to download.

In order to send that data you will have to encode it using urlencode. This is different than sending the transaction file above because you do not want it encoded as multipart form data, which is what happens when you pass an array to CURLOPT_POSTFIELDS. You want to pass your values as a urlencoded string instead.

$post_values = array();
$post_values["szSerialNumber"] = 123456789;
$post_values["szDeveloperSerialNumber"] = 123456789;
$post_values["szUploadDateFrom"] = date("m/d/Y");
// typically we will be checking for a batch the same day we upload it

// make url encoded string to send with x-www-form-urlencoded
$post_string = "";
foreach( $post_values as $key => $value )
$post_string .= "$key=" . urlencode( $value ) . "&";

$post_string = rtrim( $post_string, "& " ); // get rid of the extra one from foreach

// developer url to check file status
$checkurl = "";

$request = curl_init($checkurl); // initiate curl object
curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
curl_setopt($request, CURLOPT_POST, 0);
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);

$post_response = curl_exec($request); // execute curl post and store results in $post_response
curl_close ($request); // close curl object

You can read the lines in the $post_response and see your transaction results.