Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8806087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:02:03+00:00 2026-06-14T02:02:03+00:00

Here is the code, I cannot find any unenclosed single or double quotes –

  • 0

Here is the code, I cannot find any unenclosed single or double quotes – but when executed it returns

Parse error: syntax error, unexpected ‘}’, expecting T_STRING
client.php on line 137

:

    <?php
/**
 * An API client for Dropbox
 */
class DropboxClient
{
    protected $Session = null;

    /**
     * Common API URL
     * @var
     */
    protected $dropboxAPIURL = "https://api.dropbox.com/1";

    /**
     * Content-related API URL
     * @var
     */
    protected $dropboxContentAPIURL = "https://api-content.dropbox.com/1";

    /**
     * Constructor
     *
     * Initialize the client wit a valid session
     *
     * @param  object  $session
     * @return void
     */
    function __construct( DropboxSession $session) {
        $this->Session = $session;
        $this->accessType = $this->Session->getAccessType();
    }

    /**
     * Retrieve information from the user's account
     *
     * @return string
     */
    public function accountInfo() {
        $response = $this->Session->fetch("GET", $this->dropboxAPIURL, "/account/info");
        return $response["body"];
    }

    /**
     * Fetch metadata for a file or folder
     *
     * The path is relative to a root (ex /<root>/<path>) that can be 'sandbox' or 'dropbox'
     *
     * @param  string   $path             The path of the resource to fetch
     * @param  boolean  $list             Whether to list all contained files (applies only to folders)
     * @param  int      $fileLimit        Max items returned with the listing mode
     * @param  string   $hash             Hash value for a previous call
     * @param  string   $revision         Specific revision for the object
     * @param  bool     $includeDeleted   Whether to include deleted files and folders
     * @return string
     */
    public function metadata($path, $list = true, $fileLimit = 10000, $hash = null, $revision = null, $includeDeleted = false) {
        // Prepare argument list
        $args = array(
            "file_limit" => $fileLimit,
            "hash" => $hash,
            "list" => (int) $list,
            "include_deleted" => (int) $includeDeleted,
            "rev" => $revision
        );

        // Prepend the right access string to the desired path
        if ("dropbox" == $this->accessType) {
            $path = "dropbox" . $path;
        }
        else {
            $path = "sandbox" . $path;
        }

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

    /**
     * Downloads a file from the user's Dropbox
     *
     * The path is relative to a root (ex /<root>/<path>) that can be 'sandbox' or 'dropbox'
     *
     * @param  string   $path             The path of the resource to fetch
     * @param  string   $outFile          The download path for the file
     * @param  string   $revision         Specific revision for the object
     * @return array
     */
    public function getFile($path, $outFile = null, $revision = null) {

        $args = array();
        if (!empty($revision)) {
            $args["rev"] = $revision;
        }

        // Prepend the right access string to the desired path
        if ("dropbox" == $this->accessType) {
            $path = "dropbox" . $path;
        }
        else {
            $path = "sandbox" . $path;
        }

        // Get the raw response body
        $response = $this->Session->fetch("GET", $this->dropboxContentAPIURL, "/files/" . $path, $args, true);

        if ($outFile != null) {
            if (file_put_contents($outFile, $response["body"]) === false) {
                throw new Exception("Unable to write file '$outfile'");
            }
        }

        return array(
            "name" => ($outFile) ? $outFile : basename($path),
            "mime" => $response["headers"]["content-type"],
            "meta" => json_decode($response["headers"]["x-dropbox-metadata"]),
            "data" => $response["body"]
        );
    }

    /**
     * Upload a file to the user's Dropbox
     *
     * The path is relative to a root (ex /<root>/<path>) that can be 'sandbox' or 'dropbox'
     *
     * @param  string   $file       The full path of the file to upload
     * @param  string   $path       The destination path (default = root)
     * @param  string   $name       Specifies a different name for the uploaded file
     * @param  boolean  $overwrite  Overwrite any existing file
     * @return array
     */
    public function putFile($file, $path = "/", $name = null, $overwrite = true) {
        // Check for file existence before
        if (!file_exists($file)) {
            throw new Exception("Local file '" . $file . "' does not exist");\
        }

        // Dropbox has a 150MB limit upload for the API
        if (filesize($file) > 157286400) {
            throw new Exception("File exceeds 150MB upload limit");
        }

        $args = array(
            "overwrite" => (int) $overwrite,
            "inputfile" => $file
        );

        // Prepend the right access string to the desired path
        if ("dropbox" == $this->accessType) {
            $path = "dropbox" . $path;
        }
        else {
            $path = "sandbox" . $path;
        }

        // Determine the full path
        if (!empty($name)) {
            $path = dirname($path) . "/" . $name;
        }
        else {
            $path .= basename($file);
        }

        // Get the raw response body
        $response = $this->Session->fetch("PUT", $this->dropboxContentAPIURL, "/files_put/" . $path, $args);

        return $response["body"];
    }
}

I cannot find any part of the code that could be causing the error on line 137 or above?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T02:02:05+00:00Added an answer on June 14, 2026 at 2:02 am

    You have a backslash in the code on line 136:

    throw new Exception("Local file '" . $file . "' does not exist");\
                                                                     ^
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use PdfSmartCopy from ItextSharp but I cannot find any relevant
I am getting a CloneNotSupportedException, but I cannot find anywhere in my code where
I try to reuse an STL iterator, but cannot find any info about this.
I am using Bit Miracle LibTiff.Net. I cannot find any sample code to take
I know similar questions have already been asked, but I cannot find any answers
I cannot find any documentation on error codes with regard to Android. I am
I cannot get this to work, here is code that I found in another
Ok the error is showing up somewhere in this here code if($error==false) { $query
I have been reading SO for some time now, but I truly cannot find
I am using a GChart in my web app and cannot find any information

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.