DropPHP – simple PHP Dropbox API Client without cURL
AMPHP Projects,
DropPHP provides a simple interface for Dropbox’s REST API to list, download and upload files.
For authentication it uses OAuthSimple, HTTPS requests are made with PHP’s built in stream wrapper. It does not require any special PHP libarys like PECL, cURL or OAUTH.
It is released under a BSD license and there is a GitHub pageChangeDiva.
www.cronistalascolonias.com.ar
Version:
Author: | Fabian Schlieper |
Category: | Scripts&Codes |
Date: | 9. December |
Functions
The class DropboxClient provides the following API functions.
On failure a DropboxException is thrown, so make sure you call the functions in a try-catch block.
Functions having argument dropbox_file/dropbox_path accept this to be a string or file/folder metadata Download FoxPlayer.
GetAccountInfo() | Retrieves information about the user’s account. Returns an object with account data. |
---|---|
GetMetadata($dropbox_path) | Retrieves file and folder metadata쯔바이. |
GetFiles($dropbox_path=”, $recursive=false) | Get file list of a folder. Returns an array where keys the file paths and values metadata. If $recursive is true, all sub-folders are recursivly scanned. Note that this can take some time because each sub-folder causes a new API request. |
DownloadFile($dropbox_file, $dest_path=”, $revision=-1) | Downloads a file to the specified location on the webserver Download Internet Explorer 11 file. The destionation directory has to exist. $revision: The revision of the file to download. This defaults to the most recent revision. Returns metadata of the downloaded file. |
UploadFile($src_file, $dropbox_path=”) | Uploads a file from webserver to dropbox. Returns metadata of the uploaded file lg intelligent update 다운로드. |
GetLink($dropbox_file, $preview=true) | Returns a download link to a file. If $preview is true it creates a link users can use to view a preview of the file in a web browser. |
Delta($cursor) | Retrieves file changes. See delta |
Copy($from_path, $to_path) | Copies a file or folder to a new location Download the New People Bible. |
CreateFolder($path) | Creates a folder. |
Delete($path) | Deletes a file or folder. |
Move($from_path, $to_path) | Moves a file or folder to a new location. |
Dropbox REST API Authentication
Dropbox Rest API uses OAuth for authentication 산타나. When the Dropbox is accessed for the first time, the PHP Client retrieves a request token from Dropbox webservice. This token needs to be authorized for a Dropbox user account, so the user is redirected to an authentication page where they allow the app access to their account. Afterwards the user is redirected back to the web application, where DropPHP uses the previously stored request token (and secret) to retrieve an access token certificate form. This access token is saved and will be used to authorize any further API requests.
Setup
- Create a Dropbox App
- Copy & Paste the App key and secret to the PHP code, that creates the DropboxClient object:‘app_secret’ => “YOUR_APP_SECRET”,’app_full_access’ => false, // if the app has full or folder only access),’en’); // language/country code
- See www.cronistalascolonias.com.ar Your web application should run like the following logic (pseudo code):
Load Access Token$dropbox->SetAccessTokenElseIf ThenLoad previously stored request token$dropbox->GetAccessToken (using the request token)Save Access Token
Delete request token
Else
$dropbox->GetRequestToken
Save the request token secret
$dropbox->BuildAuthorizeUrl
Redirect to authorize url
Exit
EndIf
Do Dropbox stuff
Tokens
A token is an alpha-numeric code used to authorize API requests Naver Calendar pc. Each token has a secret key, which is like a password to use the token. DropPHP uses an array to store tokens:
Array
(
[t] => 6lj3i20m4fsgi6y
[s] => 2pn7x2bjsm3xvq8
)
At Index t is the actual token, s is the token secret. In www.cronistalascolonias.com.ar, this array is just serialized and written to a file (function store_token) in the folder /tokens. You should use your own method to save and load tokens (i.e windows xp iso 한글 다운로드. MySQL). Of course you can put the tokens in PHP’s $_SESSION array, then you have have to re-authenticate every new session.
If you get a wrapper not found error, make sure the PHP extension OpenSLL is loaded in www.cronistalascolonias.com.ar:
extension=php_www.cronistalascolonias.com.ar
www.cronistalascolonias.com.ar
Version:
Author: | Fabian Schlieper |
Category: | Scripts&Codes |
Date: | 9. December |
KeyCommander3D Head Tracking using Webcam Kinect
-
-