如何在Dropbox中从响应json获取图像

时间:2016-06-30 11:14:46

标签: php json dropbox dropbox-api dropbox-php

我想要检索存储在我的保管箱帐户中的所有图像。我尝试很多解决方案但是我无法检索图像。图像位于Dropbox帐户的文件夹中。任何人都可以帮帮我吗?

$session = new DropboxSession(
    $config["dropbox"]["app_key"], 
    $config["dropbox"]["app_secret"], 
    $config["dropbox"]["access_type"], 
    $access_token
);
$client = new DropboxClient($session);

$path = (!empty($_GET["path"])) ? $_GET["path"] : "/";
// List contents of home directory
if ($home = $client->get_files($path)) {
    echo "<p>Metadata content for <code>" . $path . "</code></p>";
    echo "<pre>" . print_r($home, true) . "</pre>";
}
    }
    catch (Exception $e) {
    echo "<strong>ERROR (" . $e->getCode() . ")</strong>: " . $e->getMessage();
    if ($e->getCode() == 401) 
    {
     // Remove auth file
     unlink($config["app"]["authfile"]);
     // Re auth
     echo '<p><a href="authorize.php">Click Here to re-authenticate</a></p>';
    }
 }

这是DROPBOX客户端功能。

   public function get_files($path, $hash = null, $revision = null) {
    // Prepare argument list
    $args = array(
        "hash" => $hash,
        "rev" => $revision
    );
    // Prepend the right access string to the desired path
    if ("dropbox" == $this->accessType) {
        $path = "auto" . $path;
    }
    else {
        $path = "sandbox" . $path;
    }

    // Execute
        $response = $this->Session->fetch("GET", $this->dropboxAPIURL,    "/shares/" . $path, $args);
    return $response["body"];
}

错误:找不到Dropbox / Photos 任何想法???

0 个答案:

没有答案
相关问题