Easily integrate Dropbox in your PHP application
An interesting project started less than a week ago, allows anyone to easily integrate Dropbox into their PHP application.
This is an interesting tool as now anyone who writes PHP applications, can easily piggyback on Dropbox to store data across platforms, users, and computers.
The usage is pretty simple, here are a few examples:
Fetching account info:
<?php
/* Please supply your own consumer key and consumer secret */
$consumerKey = '';
$consumerSecret = '';
include 'Dropbox/autoload.php';
session_start();
$dropbox = new Dropbox_API($consumerKey, $consumerSecret);
header('Content-Type: text/plain');
print_r($dropbox->getAccountInfo());
?>
Downloading a file:
<?php
/* Please supply your own consumer key and consumer secret */
$consumerKey = '';
$consumerSecret = '';
include 'Dropbox/autoload.php';
session_start();
$dropbox = new Dropbox_API($consumerKey, $consumerSecret);
header('Content-Type: image/jpeg');
echo $dropbox->getFile('flower.jpg');
?>
Uploading a file:
<?php
/* Please supply your own consumer key and consumer secret */
$consumerKey = '';
$consumerSecret = '';
include 'Dropbox/autoload.php';
session_start();
$dropbox = new Dropbox_API($consumerKey, $consumerSecret);
// This method uploads the example script.
if($dropbox->putFile(basename(__FILE__),__FILE__)) {
echo "Success\n";
}
?>
A few uses I can think of from the top of my head:
- For platforms such as WordPress — allowing users to have their content/files directory linked directly to their computer. Never upload anything to your blog/site again, simple save it to your designated dropbox folder, and it will instantly show on your site.
- Again, in WordPress like platforms, you can setup the themes/plugins directory and edit it directly from your computer, and instantly see the changes on the site
If you have any interesting uses, let me know!
Visit the project website: Dropbox-PHP — Dropbox client library for PHP
4 Comments to “Easily integrate Dropbox in your PHP application”
Leave a Reply


[…] Zobacz resztę artykułu: Eli’s » Easily integrate Dropbox in your PHP application […]
Valuable info. Lucky me I found your site by accident, I bookmarked it.
Keep posting stuff like this i really like it
Terrific work! This is the type of information that should be shared around the web. Shame on the search engines for not positioning this post higher!