Skroutz API Class

in PHP, Skroutz, Class

I've recently been tasked with integrating Skroutz.gr price information with existing Drupal sites. Since I'm going through the trouble, I like to make things modular -- hence the first step was to create a PHP5 class to handle the "low level" communication.

The class will take care of authenticating whenever needed, caching authentication tokens, and perform queries using the least possible parameters. It currently only supports raw queries as well as SKU queries, since those are the parts that I need; however it provides a base to extend for whatever other need arises.

Be sure to check out the relevate Drupal 6 module that I've created for this class!

Features: 
  • Handles all communications via cURL and JSON
  • Performs authentication whenever required 
  • Supports authentication token caching to reduce overhead
  • Supports result object caching to reduce network chatter
  • Supports fetching price information via SKU
  • Supports partial field fetching ( full Skroutz object is large! )
  • Can be instantiated both as a simple object or using the singleton pattern
Changelog: 
  • v.0.3
    • Implemented fetching by SKU method
    • Implemented partial field resultset
  • v.0.2
    • Implemented authentication token caching
    • Implemented result object caching
    • Implemented singleton pattern instantiation
  • v.0.1
    • Implemented low level cURL communication
    • Implemented authentication
    • Implemented raw querying
Requirements: 
  • PHP 5 ( all tests performed on PHP 5.1.6 and 5.2+ )
  • cURL compiled into PHP

If your PHP version is less than 5.2.x you will have to load an implementation of JSON before this class can run, otherwise you will get a lot of errors.

File attachments: 
Custom Scripts