Comments (4)
Hi,
I just tried it and it seems fine to me. I tried getInfo with AudioStation and DownloadStation.
First how are you running the script? Through you're browser or via command line?
Then I'm guessing the autoload might be the problem, I'm using "include" instead of "require" which might just throw a notice, which you might not see depending on your PHP settings. Try the following code and check if the new include path looks ok, meaning are all the "/" look like "/" and not "". Also here I'm using require instead of include and this will throw a fatal error if it's not working:
echo 'Include_path = '.get_include_path().PHP_EOL;
echo 'path_separator = '.PATH_SEPARATOR.PHP_EOL;
set_include_path(dirname(__FILE__).'/library'.PATH_SEPARATOR.get_include_path());
echo 'New Include_path = '.get_include_path().PHP_EOL.PHP_EOL;
function __autoload($class_name) {
$path = str_replace('_', DIRECTORY_SEPARATOR, $class_name);
echo 'Loading: '.$class_name.' => '.$path.'.php'.PHP_EOL;
require($path . '.php');
}
$synology = new Synology_DownloadStation_Api('192.168.10.5', 5000, 'http', 1);
echo 'Great'.PHP_EOL;
My output look like that:
Include_path = .:
path_separator = :
New Include_path = /Users/zzarbi/pool/synology/library:.:
Loading: Synology_DownloadStation_Api => Synology/DownloadStation/Api.php
Loading: Synology_Api_Authenticate => Synology/Api/Authenticate.php
Loading: Synology_Abstract => Synology/Abstract.php
Loading: Synology_Api => Synology/Api.php
Great
from synology.
Wow, thanks for your timely response! I tried it and, figured out where my error was. Very helpful!
I think I slightly misunderstood the purpose of this project. I imagined it provided a implementation of the FileStation API, something I haven't seen anywhere else. My goal is retrieve all the files in a folder, list them on the page (browser) and allow users to download the files (save as). Do you expect to still add this feature?
I have been trying to implement a new API using your framework, but so far been unsuccessful.
from synology.
Hi,
I just implement just that (717804e).
With the last code you can get a list of shares for FileStation:
$synology = new Synology_FileStation_Api('192.168.10.5', 5000, 'http', 1);
$synology->activateDebug();
$synology->connect('admin', 'xxx');
print_r($synology->getShares());
Get a list of files:
print_r($synology->getList('/home'));
And download one file:
// need to disable debug
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="test.txt"'); //<<< Note the " " surrounding the file name
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
echo $synology->download('/home/text.txt');
This should work in a browser, altho i didnt test it. You can continue the implementation if you want using this PDF (http://ukdl.synology.com/download/Document/DeveloperGuide/Synology_File_Station_API_Guide.pdf)
from synology.
I can confirm that it works beautifully. I simply use the function to do the following:
foreach ($listing->files as $file) {
$file->name;
$file->path;
}
It probally makes sense to add this to your Read.me and you could also trow it in the example.
from synology.
Related Issues (17)
- Problem on login with new DSM 5.1 HOT 4
- destination option in downloadStation Api
- Authentication fails if secure
- Help request
- Throw error codes instead of exceptions
- Composer integration HOT 2
- Surveillance Station API -> SetCameraSchedule HOT 1
- FileStation: Split out additional data into separate arrays HOT 2
- class Synology_Abstract (Abstract.php) contains never used private $_errorCodes HOT 2
- Note Station API
- Class "Synology\Api" not found
- does this still work? HOT 1
- Connect timeout HOT 1
- Cannot connect to Synology HOT 1
- Problem with method download & Filestation API HOT 3
- Added support for BT Search HOT 1
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 synology.