RESTful API application using Zend Framework

What is REST?

REST is an architectural style, or set of conventions, for web applications and services that centers itself around resource manipulation and the HTTP spec. Web apps have traditionally ignored the HTTP spec and moved forward using a subset of the protocol: GET and POST, 200 OKs and 404 NOT FOUNDs. As we entered a programmable web of applications with APIs the decision to ignore HTTP gave us problems we’re still dealing with today. We have an internet full of applications with different interfaces (GET /user/1/delete vs. POST /user/delete {id=1}). With REST we can say /user/1 is a resource and use the HTTP DELETE verb to delete it. For more detail on REST check out wikipedia and “quick pitch“

PHP RESTful Framework:

There are plenty of RESTful Framework for PHP out there, here are some of theme

  • Zend Framework
  • Recess PHP Framework
  • Slim Framework for PHP 5
  • Tonic

We are currently in a progress of creating a brand new RESTful API application for Video Direct Ltd. Hopefully, we could have some spare time to write a small example on how to build RESTful API application using Zend Framework.

If you know a better PHP RESTful framework out there, share your thoughts.

 

 

Posted in PHP, Web development | Leave a comment

Export data to CSV file using MySQL query (data contains single and double quote)

It is really straight forward to export data from your database to CSV file. However, when your data contains some special characters such as single or double quote, it could destroy your CSV file’s structure completely and end up of messy CSV fiel content.

This code would help

SELECT authorname, authoremail, REPLACE(REPLACE(content,'"',''),"'","") as escapeContent , datecreated FROM feedback_table WHERE content IS NOT NULL AND content <> '' ORDER BY datecreated DESC
INTO OUTFILE './feedback.csv'
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\n'

In the previous example of code it simply remove all single and double quote from the content column. It is not good practice in some case, but you could also can use the backslash.

 REPLACE(REPLACE(content,'"','\\"'),"'","\\'")
Posted in Web development | Leave a comment

Paypal Website Payments Pro UK & US to Pre-order

Updated 21-Apr-2011:  Paypal Website Payments Pro for UK, US, Canada and other countries released! Grab your own copy today to improve your business conversion rates.  BUY NOW

The first version of Paypal website payments pro module for Prestashop was released back in late 2009. We are now working really hard to get the version 2.0.0 out of the door on 18th of April.

You all can preorder on Quay Marketplace for a special discount of 30% off. This price will not last for too long so you need to hurry. Once the module released on 18th April, the price will be on sale in full.

 

Posted in Prestashop | Tagged , , , | Leave a comment

Download issue with Virgin Media router WGR614v9

Virgin Media

One of the biggest broadband provider in UK took over Telewest more than 5 years ago. Virgin Media broadband package with reasonable price seems to hit many household around UK especially students.

We signed up with VM 2 years ago and things went quite smoothly although there are couple of time the internet connection was down for a whole day due to cable issue in some of the area and until I purchased my first MacBook and trying to update iTunes on my PC.

What went wrong?
Things went terribly wrong when I could not download and install any software or even update apple software on my MB. Getting many different error message and trying to figure out what is going on with my Macbook is quite frustrating

Error messages:

The update could not be expanded and verified. It may have been corrupted or tampered with during downloading. The update will be downloaded and checked again the next time that Software Update runs.

The following disk images couldn’t be opened. Reason: invalid checksum

And sometime the FTP client does not work either.

Support?
One hour on the phone with Apple support staff without any luck and they decided to replace my MB. I went to apple store to sort if out and surprisingly it is all working again. The only suspicious we got in mind is to do with our router at home.

Posting questions on forums and try to upgrade the router firmware but it is impossible to do so as Virgin Media lock it completely.

New router

After a few weeks, I decided to purchase a cheapest router (Tenda Wireless-N150) from ebuyer (http://www.ebuyer.com/product/169923) to replace for VM router. It looks only 5 minutes to install and setup the wireless but all problem we were facing are now completely gone.

If anyone got the same problem above with Virgin Media router, I would recommend to replace it with your own router. VM also sell routers on their website, but it is quite expensive.

Posted in Viva | 2 Comments

Google Base Products Feed for Tradingeye and UK2 Ecommerce v1.0

Google Base Products (Froogle)

Recently, I tried to use current Froogle Feeds in Tradingeye (both v5 & v6) to products into Google Product listing service (http://www.google.co.uk/products).  However, there is still a little buggy and limitation of this feed as it exports all products under text format.

I noticed a fact not all of your products are added to Google Base Products. Besides, product short description is being treated as product description, so if a product does not have short description then it would not be added to Google Base at all !

Okay, we have created a new script to export all product d

etail into a RSS feed (XML file format) with the following attributes:

  • Product Title
  • Price
  • Department name (New)
  • Product ID (using Sku code + ID)
  • Image URL
  • Product URL
  • Product condition

The script can be used for all Tradingeye and UK2 ecommerce users.

How to use it:

  1. Download the zip file
  2. Replace your froogle.php file in scheduler/froogle.php with the on in .zip file
  3. Open up the new froogle.php and read the instruction

Download:

Commercial supports:  please get in touch with Quay Creative at  info@quaycreative.com.

Froogle Feed - Google Based Products (266)

Posted in PHP, Tradingeye & UK2 Ecommerce, Web development | Leave a comment