<?php
//
// for more information and examples:
// http://www.bitsybox.com/support/docs
//
// Replace these values with your
// Api Key and Secret to test out your site
$apiKey = "f1d2c4aa5ef59fe6ebbf99fb988db291";
$apiSecret = "aibdreakcjd";
// require the BitsyBox Client
require "Services_BitsyBox.php";
// instaciate the client
$bb = new Services_BitsyBox($apiKey,$apiSecret);
// set the module ID that we want to request
$moduleId = 550;
// request the module
$module = $bb->getModule(array('id'=>$moduleId));
// print the contents of the field called 'title' to the page
echo $module->getField('title')->value;
?>
<?php
//
// for more information information and examples:
// http://www.bitsybox.com/support/docs
//
// Replace these values with your
// Api Key and Secret to test out your site
$apiKey = "f1d2c4aa5ef59fe6ebbf99fb988db291";
$apiSecret = "aibdreakcjd";
$apiBaseUrl = "http://api1.bitsybox.com/rest/v2.1/";
// Id of the Module
$moduleId = 550;
// we need to generate the signature for
// this api call
$apiSig = md5("{$apiKey}{$apiSecret}site");
// make the request
$response = curl( $apiBaseUrl . "site/container/id/{$moduleId}?key={$apiKey}&sig={$apiSig}" );
// if no response
if ( !$response ) {
exit("Could not make request to BitsyBox");
}
// parse the xml
$xml = simplexml_load_string($response);
// check for good response
if ( $xml['status'] != '1' ) {
exit("Recieved a bad status response from BitsyBox");
}
// return the node we want
echo (string)$xml->container->items->item->title->value;
// all done
exit(0);
////////////////////////////////////////////////
/// simple curl function
/// @method curl
/// @param $url URL to hit
/// @return string Curl content
////////////////////////////////////////////////
function curl($url) {
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// grab URL and pass it to the browser
$response = curl_exec($ch);
// check response
if ( curl_getinfo($ch,CURLINFO_HTTP_CODE) != 200) {
return false;
}
// close cURL resource, and free up system resources
curl_close($ch);
// return response
return $response;
}
?>
BitsyBox is a hosted content storage platform that offers two products that work in perfect harmony. The first is an easy-to-use web interface that lets site owners edit and update their content. The second is a robust API for developers to quickly access that content from their website or application code.
We've fully documented BitsyBox to make it easy -- so easy in fact, we guarantee you can integrate a new or existing website in just a few minutes. More Support
Check out our library of streaming videos, professionally produced to help guide you through your integration with BitsyBox.
View Screencasts
Isn't everyone these days? Make sure to follow us to stay up-to-date with everything BitsyBox Follow @bitsybox