Comments (10)
Did you follow the installation instructions? I just tried installing it as per instructions and it worked as expected.
Simply install Composer, navigate to the directory your project is in, run
composer require alorel/dropbox-v2-php
or, if you already have a composer.json
file in your project, add this package to your requirements:
{
"require": {
"alorel/dropbox-v2-php": "^0.3"
}
}
Make sure your installation meets the requirements, i.e. PHP 5.6 and newer. In the end your directory should look something like this and one of your php
files would look something like this:
<?php
use Alorel\Dropbox\Operation\Files\ListFolder\ListFolder;
use GuzzleHttp\Exception\ClientException;
require_once 'vendor/autoload.php';
$apikey = 'INPUT_YOUR_ACCESS_TOKEN_HERE';
$list = new ListFolder(false, $apikey);
try {
var_dump(
json_decode(
$list->raw('/path-to-folder')->getBody()->getContents(),
true
)
);
} catch (ClientException $e) {
echo $e->getMessage();
}
from dropbox-v2-php.
Please follow the installation instructions on the Readme and look at the examples.
This package requires knowledge of Composer and namespacing in PHP. Please look at how both of those are used before raising any more questions that aren't tied to this package.
This package will not work if you just clone the source and try to use it.
from dropbox-v2-php.
You'll find your answer in Composer's getting started documents. Everything works, otherwise it wouldn't have passed the unit tests on Travis-CI.
<?php
use Alorel\Dropbox\Operation\Files\SaveUrl\CheckJobStatus;
use Alorel\Dropbox\Operation\Files\SaveUrl\SaveURL;
################################
# INCLUDE THE AUTOLOADER BELOW #
################################
require_once 'vendor/autoload.php';
##################
# IT'S IMPORTANT #
##################
SaveURL::setDefaultToken('Your token');
SaveURL::setDefaultAsync(false);
$saveURL = new SaveURL();
$resp = json_decode($saveURL->raw('/google.html', 'https://www.google.com')->getBody()->getContents(), true);
if (isset($resp['async_job_id'])) {
$check = new CheckJobStatus();
do {
echo 'Not saved yet - waiting for 3 seconds before checking for the job status' . PHP_EOL;
sleep(3); //Wait a bit
$r = json_decode($check->raw($resp['async_job_id'])->getBody()->getContents(), true);
} while (isset($r['.tag']) && $r['.tag'] == 'in_progress');
echo 'URL saved';
} else {
echo 'URL saved';
}
from dropbox-v2-php.
Thank man
I not found the liblary alorel/dropbox-v2-php and i think maybe it not done.
Thank you a lot for only 1 API v2 dropbox on github.
Can i ask a question, should do i use v1 or v2 dropbox api for better performance, i only need upload via API of dropbox but so hard to find a simple example to upload dropbox via api. example almost by native code or library not via API.
Thank again for beautiful code. :)
from dropbox-v2-php.
It's just the way Composer works. 😉 This SDK is as close as you can get to raw API calls - all it does is wrap HTTP requests in PHP code. Have a look at the general instructions, upload and UploadSession examples and their documentation here and here. The arguments these methods receive map directly to the ones the Dropbox API expects.
As for v1 vs v2, definitely go for v2 - it's newer and more actively developed, Dropbox want you to use v2, too.
Let me know if you have any more questions - if not, I'll be closing the issue.
from dropbox-v2-php.
Can you tell me how to use /save_url.
i use https://github.com/Alorel/dropbox-v2-php/blob/master/examples/Raw/Files/SaveURL.md
but have this error
from dropbox-v2-php.
<?php
use Alorel\Dropbox\Operation\Files\SaveUrl\CheckJobStatus;
use Alorel\Dropbox\Operation\Files\SaveUrl\SaveURL;
use Alorel\Dropbox\Operation\Files\ListFolder\ListFolder;
use GuzzleHttp\Exception\ClientException;
$saveURL = new SaveURL();
$resp = json_decode($saveURL->raw('/google.html', 'https://www.google.com')->getBody()->getContents(), true);
if (isset($resp['async_job_id'])) {
$check = new CheckJobStatus();
do {
sleep(3); //Wait a bit
$r = json_decode($check->raw($resp['async_job_id'])->getBody()->getContents(), true);
} while (isset($r['.tag']) && $r['.tag'] == 'in_progress');
//You're done - URL saved
} else {
//You're done - URL saved
}
from dropbox-v2-php.
Thank Alorel for the answer :)
i had success run your example
But some error when i use some namespace
<?php
use Alorel\Dropbox\Operation\Files\ListFolder\ListFolder; //is okay
use GuzzleHttp\Exception\ClientException;//is okay
use Alorel\Dropbox\Operation\Files\SaveUrl\CheckJobStatus;//is okay
use Alorel\Dropbox\Operation\Files\SaveUrl\SaveURL; //return not found
Hope i don't disturb you.
Can you help me once more time, please!
When i use
<?php
use Alorel\Dropbox\Operation\Files\ListFolder\ListFolder; //is okay
use GuzzleHttp\Exception\ClientException;//is okay
use Alorel\Dropbox\Operation\Files\SaveUrl\CheckJobStatus;//is okay
it return okay but when
<?php
use Alorel\Dropbox\Operation\Files\ListFolder\ListFolder; //is okay
use GuzzleHttp\Exception\ClientException;//is okay
use Alorel\Dropbox\Operation\Files\SaveUrl\CheckJobStatus;//is okay
use Alorel\Dropbox\Operation\Files\SaveUrl\SaveURL; //return not found
have error
Fatal error: Class 'Alorel\Dropbox\Operation\Files\SaveUrl\SaveURL' not found in D:\xampp\htdocs\dropbox-v2-php-master\index1.php on line 11
from dropbox-v2-php.
Thank for your kindness.
I had use composer before.
But still error, may be i wrong somewhere.
Thank again for your help and great lib and so sorry about my disturb :(
from dropbox-v2-php.
Composer on its own won't do anything - you need to include the autoloaded as I did in the example above - that way simply referencing a class by name will be enough to automatically load the file containing that class.
from dropbox-v2-php.
Related Issues (16)
- maintainer HOT 1
- hi HOT 1
- Get shared folder url in public directory HOT 1
- Invalid authorization value in HTTP header HOT 4
- How to authorize the user? HOT 1
- "HTTP ERROR 500" HOT 4
- Not getting any example code to access dropbox and these sdks in my web application.
- About Preview section in RAW Example Code HOT 1
- How to catch error or show status HOT 3
- Use stone to auto generate functions and data types HOT 1
- Authentication examples HOT 2
- how use ListFolder? HOT 1
- installation fails HOT 8
- Conflict Folder Already exists HOT 8
- Concerning maintainer of this repository. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dropbox-v2-php.