lib/Dropbox/Client.php
function getFile($path, $outStream, $rev = null)
    {
        Path::checkArgNonRoot("path", $path);
        Checker::argResource("outStream", $outStream);
        Checker::argStringNonEmptyOrNull("rev", $rev);

        $url = $this->buildUrlForGetOrPut(
            $this->contentHost,
            $this->appendFilePath("1/files", $path),
            array("rev" => $rev));

        $curl = $this->mkCurl($url);
        $metadataCatcher = new DropboxMetadataHeaderCatcher($curl->handle);
        $streamRelay = new CurlStreamRelay($curl->handle, $outStream);

        $response = $curl->exec();

        if ($response->statusCode === 404) return null;

        if ($response->statusCode !== 200) {
            $response->body = $streamRelay->getErrorBody();
            throw RequestUtil::unexpectedStatus($response);
        }

        return $metadataCatcher->getMetadata();
    }
function getFile($path, $outStream, $rev = null)
    {
        Path::checkArgNonRoot("path", $path);
        Checker::argResource("outStream", $outStream);
        Checker::argStringNonEmptyOrNull("rev", $rev);

        $url = $this->buildUrlForGetOrPut(
            $this->contentHost,
            $this->appendFilePath("1/files", $path),
            array("rev" => $rev));

        $curl = $this->mkCurl($url);
        $metadataCatcher = new DropboxMetadataHeaderCatcher($curl->handle);
        $streamRelay = new CurlStreamRelay($curl->handle, $outStream);

        $response = $curl->exec();

        if ($response->statusCode === 404) return null;

        if ($response->statusCode !== 200) {
            $response->body = $streamRelay->getErrorBody();
            throw RequestUtil::unexpectedStatus($response);
        }

        return $metadataCatcher->getMetadata();
    }
function getFile ( $ path , $ outStream , $ rev = null ) { Path :: checkArgNonRoot ( "path" , $ path ) ; Checker :: argResource ( "outStream" , $ outStream ) ; Checker :: argStringNonEmptyOrNull ( "rev" , $ rev ) ; $ url = $ this -> buildUrlForGetOrPut ( $ this -> contentHost , $ this -> appendFilePath ( "1/files" , $ path ) , array ( "rev" => $ rev ) ) ; $ curl = $ this -> mkCurl ( $ url ) ; $ metadataCatcher = new DropboxMetadataHeaderCatcher ( $ curl -> handle ) ; $ streamRelay = new CurlStreamRelay ( $ curl -> handle , $ outStream ) ; $ response = $ curl -> exec ( ) ; if ( $ response -> statusCode === 404 ) return null ; if ( $ response -> statusCode !== 200 ) { $ response -> body = $ streamRelay -> getErrorBody ( ) ; throw RequestUtil :: unexpectedStatus ( $ response ) ; } return $ metadataCatcher -> getMetadata ( ) ; }
Downloads a file from Dropbox.  The file's contents are written to the
given `$outStream` and the file's metadata is returned.

<code>
$client = ...;
$fd = fopen("./Frog.jpeg", "wb");
$metadata = $client->getFile("/Photos/Frog.jpeg", $fd);
fclose($fd);
print_r($metadata);
</code>

@param string $path
The path to the file on Dropbox (UTF-8).

@param resource $outStream
If the file exists, the file contents will be written to this stream.

@param string|null $rev
If you want the latest revision of the file at the given path, pass in `null`.
If you want a specific version of a file, pass in value of the file metadata's "rev" field.

@return null|array
The <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata
object</a> for the file at the given $path and $rev, or `null` if the file
doesn't exist,

@throws Exception
Downloads a file from Dropbox . The file s contents are written to the given $outStream and the file s metadata is returned .