title: Dropbox file upload automatically using php
body: <p>I'm playing with Dropbox API for PHP, and I would like know the correct way to upload files automatically without command line.</p>
  
  <p>Now my process is:</p>
  
  <ol>
  <li><code>php -f upload.php</code></li>
  <li>Copy long url on browser</li>
  <li>Click allow button</li>
  <li>Copy the token</li>
  <li>paste the token on console and done.</li>
  </ol>
  
  <p>My plan is do an <em>automated backup</em> of some JSON files on my Dropbox.</p>
  
  <p>Is there other way to make that without console? and copying tokens and simple solution?</p>
  
  <p><strong>EDIT</strong>
  When I try to hardcode it, the output it´s -></p>
  
  <pre><code>Fatal error: Uncaught exception 'Dropbox\Exception_BadRequest' with message 'HTTP status 400
  {"error_description": "code has already been used", "error": "invalid_grant"}'
  </code></pre>
  
  <p><strong>EDIT 2*</strong></p>
  
  <p>The access token output </p>
  
  <pre><code>dusIlAq36pkAAAAAAAAHQ6daX9hwt-3wUL240gUUjIOYrscX2OYOkCyj8ZghUgG2
  </code></pre>
  
  <p>I set it as </p>
  
  <pre><code>$authCode = 'dusIlAq36pkAAAABBBBBAAAHQ6daX9hwt-3wUL240gUUjIOYrscX2OYOkCyj8ZghUgG2';
  </code></pre>
  
  <p>Here Drop MSG</p>
  
  <pre><code> ...Fatal error: Uncaught exception 'Dropbox\Exception_BadRequest' with message 'HTTP status 400
  {"error_description": "code doesn't exist or has expired",
  </code></pre>