PHP code example of headoo / dropboxhelper

1. Go to this page and download the library: Download headoo/dropboxhelper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

headoo / dropboxhelper example snippets



    use \Headoo\DropboxHelper\DropboxHelper;

    $dropboxHelper = new DropboxHelper($yourAppDropboxToken);


    $dropboxHelper = new DropboxHelper();
    $dropboxHelper->setToken($yourAppDropboxToken);


    use \Headoo\DropboxHelper\DropboxHelper;

    $dropboxHelper = new DropboxHelper($yourAppDropboxToken);

    $dropboxHelper->write('/Path/To/The/File', 'put your content here');
    $dropboxHelper->read('/Path/To/The/File');
    $dropboxHelper->delete('/Path/To/The/File');


    use \Headoo\DropboxHelper\DropboxHelper;

    $dropboxHelper = new DropboxHelper($yourAppDropboxToken);

    $oFolder = $dropboxHelper->loadFolderPath('/Path/To/List');
    while ($oFolder && ($aMedia = $oFolder->next())) {
        if (DropboxHelper::isFolder($aMedia)) {
            echo $aMedia['name'] . ' is a folder';
        }
        if (DropboxHelper::isFile($aMedia)) {
            echo $aMedia['name'] . ' is a file';
        } 
    }


    use \Headoo\DropboxHelper\DropboxHelper;

    $dropboxHelper = new DropboxHelper($yourAppDropboxToken);

    $oFolder = $dropboxHelper->loadFolderCursor('--this--is--the--last--cursor--of--the--folder--');
    while ($oFolder && ($aMedia = $oFolder->next())) {
        if (DropboxHelper::isFolder($aMedia)) {
            echo $aMedia['name'] . ' is a folder';
        }
        if (DropboxHelper::isFile($aMedia)) {
            echo $aMedia['name'] . ' is a file';
        }
    }
    
    echo "The last cursor of the folder is: " . $oFolder->getCursor();