Pachube is a web service that enables you to connect, tag and share real time sensor data from objects, devices, buildings and environments around the world. The key aim is to facilitate interaction between remote environments, both physical and virtual.
$pachube = new Pachube($api_key);
';
$pachube = new Pachube($api_key);
# *****************************************************************
#
# working with Environments (returns an associative array)
#
# *****************************************************************
echo "$environment = $pachube->environment( $feed_id );
';
echo "\$environment['description']: ".$environment['description']."$pachube->showEnvironmentGraph($environment,1);
';
$pachube->showEnvironmentGraph($environment,1);
echo "$pachube->showEnvironmentGraph($environment,2, 700, 250, "0000FF", false, false, "My configured graph title", "My datastream units", 6);
';
$pachube->showEnvironmentGraph($environment,2, 700, 250, "0000FF", false, false, "My configured graph title", "My datastream units", 6);
echo "$pachube->showEnvironmentMap($environment, 500, 200, "GOOGLE_MAP_API_KEY");
';
$pachube->showEnvironmentMap($environment, 500, 200, "ABQIAAAAYGdShHJUqUUqCZujCgqoyxRhf0yX7jCDZEW8LvcORLdH4560mRQtTT3Vx6wORcHDcMrtNf9XNlmO0w");
#/*
# *****************************************************************
#
# retrieve Pachube feed data
#
# *****************************************************************
echo "$data = $pachube->retrieveData ($url);
';
echo $data;
echo "$data = $pachube->retrieveData ( $feed, "csv" );
';
echo $data;
echo "$data = $pachube->retrieveData ( $feed, "json" );
';
echo "$data = $pachube->retrieveData ( $feed, "xml" );
';
echo "$pachube->showGraph ( $feed_id, $datastream_id );
';
$pachube->showGraph ( $feed_id, $datastream_id );
# *****************************************************************
#
# display a configured graph
#
# *****************************************************************
echo "$pachube->showGraph ( $feed_id, $datastream_id, 500, 300, "00FF00", true, true, "My configured graph title", "My datastream units", 6 );
';
$pachube->showGraph ( $feed_id, $datastream_id, 500, 300, "00FF00", true, true, "My configured graph title", "My datastream units", 6 );
# *****************************************************************
#
# create a new Pachube feed
#
# *****************************************************************
echo "$new_feed_id = $pachube->createFeed ( $title );
';
//$new_feed_id = $pachube->createFeed ( $title );
// bad hack, but for the moment unsuccessful attempts to create simply
// return their HTTP status code, as a negative number
echo $new_feed_id;
# *****************************************************************
#
# delete a Pachube feed
#
# *****************************************************************
echo "$delete_status = $pachube->deletePachube ( $new_feed_id );
';
//$delete_status = $pachube->deletePachube ( $new_feed_id );
//$pachube->debugStatusCode($delete_status);
#/*
# *****************************************************************
#
# update manual feed: CSV
#
# *****************************************************************
echo "$update_status = $pachube->updatePachube ( $url, $data );
';
// this next line makes the actual update attempt and returns a status code
$update_status = $pachube->updatePachube ( $url, $data );
$pachube->debugStatusCode($update_status);
# *****************************************************************
#
# update manual feed: EEML
#
# *****************************************************************
echo "$update_status = $pachube->updatePachube ( $url, $data );
';
$data = <<$history = $pachube->retrieveHistory ( $url );
';
$history = $pachube->retrieveHistory ( $url );
print_r ($history);
# *****************************************************************
#
# Retrieving lat/lon of feeds that contain a term as an array
# currently only displays first 10 ordered by 'retrieved_at'
#
# *****************************************************************
echo "$latitude_and_longitudes = $pachube->getLatLon("current cost");
';
$latitude_and_longitudes = $pachube->getLatLon("current cost");
print_r ( $latitude_and_longitudes );
echo "