WAMP + CodeIgniter + Sparks

I was recently decided to give the Get Sparks project a try. If you are not familiar with the Get Sparks project for Codeigniter, it allows you to download packages/modules for quickly installing into your app. Similar to the idea with PEAR extensions for PHP. I am setting this up on my Windows box using WAMP. I followed the setup instructions from the Get Sparks website, and everything went perfectly fine. I decided to download the popular spark “curl”, and kept getting the:

"You have to install PECL ZipArchive or `unzip` to install this spark."

I kept checking in my php.ini file that php_zip.dll was enabled.  Hmmm…..

So, I decided to create a test script to test the code that was creating this error message. Running the PHP script in the browser ran ZipArchive() successfully. Next, I ran this test PHP script from the command line (CLI). I got a “Fatal Error:  Class ZipArchive not found in …” error. I couldn’t quite figure out why PHP was throwing an error on the CLI and not when run in the browser. A little digging found that PHP run from the command line uses relative paths including php.ini. This the part where WAMP comes into play. For those using WAMP, your php.ini file that is used is located in C:\wamp\bin\apache\Apache2.2.11\bin not where PHP is being executed from. Ah ha! So I went and opened C:\wamp\bin\php\php5.2.9-2 and scrolled down to find:


So I changed this to:

php tools\spark install -v1.2.0 curl

Enabling php_zip.dll in the PHP folder of WAMP, and ran the Sparks command again. Success! The spark was downloaded, unzipped, and installed with no more error.

CodeIgniter + UPS Worldship

This is a post I have been to get around to for quite awhile. At work we have UPS Worldship installed on our desktops for shipping out packages. I had written a small php script that could open the UPS Worldship database, and report all of our tracking numbers with links. UPS had switched from being an unprotected Microsoft Access database file, to using a Microsoft SQL (MSSQL database). This kind of broke my little php script I had written, but I was eventual able to work something together. Recently, I installed the latest update UPS Worldship 2010 Version 12. Wouldn’t you know it, broken again. I couldn’t get my little script working again. ODBC access had been removed from this version. I could no longer connect to the MS SQL  dabatabe for UPS Worldship.

Continue reading CodeIgniter + UPS Worldship

CodeIgniter + Chargify

I recently began integrating the Chargify service into a web app I am coding for codeigniter. Chargify is seems to be a slick web service for creating subscription based services. They provide a strong API, and along with a slick web based dashboard (GUI). One of the points on using the API are Chargify postbacks. I did some quick googling and didn’t turn up much in the way of chargify and codeigniter. I did find a great library for integrating the API called ChargeIgniter.

Chargify will send a json array back a POST var to your site. The docs for Chargify don’t state what variable they are submitted as. This is what I came up with.

function post_back(){
        $body = file_get_contents("php://input");
        $replace = array('[', ']');
        $replacements = array('', '');
        $body = explode(',', str_replace($replace, $replacements, $body));
       //$body now contains array of subscription ID's
       //Iterate through returned subscription IDs
       foreach($body as $subscription_id){
            $subscription = $this->chargify->get_subscription($subscription_id);
            //Do something here with $subscription details

CodeIgniter + Whitepages.com API Library

I was recently working on another Codeigniter project that I needed to grab some phone, address, & map information for plotting on a map. After doing a little searching I found Whitepages.com has provided an API interface for retrieving data via REST. The methods seemed simple enough, and provided an easy way to create a CodeIgniter library to due the dirty work. Continue reading CodeIgniter + Whitepages.com API Library

Codeigniter + Geshi

Geshi is a PHP class to do the heavy lifting for syntax highlighting output to your browswer. Geshi started originally to help users highlight code posted on bulletin board sites. I converted the standard Geshi class into a Codeigniter library. Just a simple as renaming the class and created a few methods to conform to some of the options you’ll find in codeigniter.
Continue reading Codeigniter + Geshi

CodeIgniter Shopping Cart Library

CodeIgniter is a great PHP framework to work with. One of the items several CodeIgniter Logodevelopers have been asking to be included in the next CodeIgniter release, is a core library for a shopping cart. The library is being added for CI version 1.7.2, and is currently available via SVN on the CodeIgniter website.

UPDATE 09/12/2009: The shopping cart library has now been released as part of the Code Igniter stable release version 1.7.2. You can dowload it at CodeIgniter.com

Continue reading CodeIgniter Shopping Cart Library

Open Flash Chart 2 + CodeIgniter

Many of you maybe familiar with the CodeIgniter (CI) PHP framework. I was asked by a client recently about creating a graph for some data in a report. CodeIgniter LogoLooking through several charting libraries at the CI website, I found a few options listed in the wiki. Open Flash Chart 2 (OFC) seemed like a nice option and was also open source. There was a couple libraries written for CI using Open Flash Chart, but the recent code for OFC has recently changed. Continue reading Open Flash Chart 2 + CodeIgniter