I'm looking for a php script that I can use on my website to upload to dropbox everytime I hit refresh. Of course I'm going to tighten it better but for now I'm just looking for a php script that can do the job. I have pictures on my server that I want to back up into my dropbox account. Is this still possible? I keep seeing this API for dropbox but I feel its only for mobile apps as in the descriptions it keeps saying app this app that.
The Dropbox API is an interface for programmatically interacting with Dropbox. The documentation uses the term "apps" to mean any program, and not just mobile apps.
You can find everything you need to get started with the Dropbox API here:
https://www.dropbox.com/developers
For example, here's an example of uploading to a Dropbox account using the Dropbox API with PHP:
<?php
$path = 'test_php_upload.txt';
$fp = fopen($path, 'rb');
$size = filesize($path);
$cheaders = array('Authorization: Bearer <ACCESS_TOKEN>',
'Content-Type: application/octet-stream',
'Dropbox-API-Arg: {"path":"/test/'.$path.'", "mode":"add"}');
$ch = curl_init('https://content.dropboxapi.com/2/files/upload');
curl_setopt($ch, CURLOPT_HTTPHEADER, $cheaders);
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_INFILESIZE, $size);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
echo $response;
curl_close($ch);
fclose($fp);
?>
<ACCESS_TOKEN>
should be replaced with the OAuth 2 access token.