public function setOutFile($handle)
if (!is_resource($handle) || get_resource_type($handle) != 'stream') {
throw new Dropbox_Exception('Outfile must be a stream resource');
$this->outFile = $handle;
* @param resource Resource to read data from
public function setInFile($handle) {
* Parse response parameters for a token into an object
* Dropbox returns tokens in the response parameters, and
* not a JSON encoded object as per other API requests
* @link http://oauth.net/core/1.0/#response_parameters
* @param string $response
* @return object stdClass
private function parseTokenString($response)
$parts = explode('&', $response);
foreach ($parts as $part) {
list($k, $v) = explode('=', $part, 2);
* Encode a value to RFC3986
* This is a convenience method to decode ~ symbols encoded
* by rawurldecode. This will encode all characters except
* the unreserved set, ALPHA, DIGIT, '-', '.', '_', '~'
* @link http://tools.ietf.org/html/rfc5849#section-3.6
private function encode($value)
return str_replace('%7E', '~', rawurlencode($value));