It’s getting hard to keep up with all the Remix activity.
Matt Williams has put together a PHP library for Remix.
Code sample:
require_once 'BestBuy/Service/Remix.php';
$apiKey = '12345678'; // Your API key
$remix = new BestBuy_Service_Remix($apiKey);
// Retrieve a list of stores within 10 miles of a zip code
$result = $remix->stores(array('area(10006,10)'))->query();
// Result objects may be implicitly cast as strings
echo $result;
// Retrieve a list of Movies containing the text "Bat"
$result = $remix->products(array('name=bat*','type=Movie'))->query();
if(!$result->isError())
{
echo $result;
}
else if(403 != $result->http_code)
{
// API errors result in an error document with detailed info
echo current($result->toSimpleXml()->xpath('/error/message'));
}
else
{
// 403 errors do not contain a full error document, only an h1 message
echo $result->data;
}
// Retrieve fields from a list of Movies starting with "Bat" in JSON format
$result = $remix->products(array('type=Movie', 'name=bat*'))
->show(array('name','regularPrice','url', 'sku'))
->format('json')
->query();
echo $result;
// Check for store availability of a Playstation 3 in a given area
$result = $remix->stores(array('area(10006,10)'))
->products(array('sku=8982988'))
->sort('distance')
->query();
echo $result;
About the Author