Synology diskstation Support #1

Open
opened 2020-06-22 07:13:14 +00:00 by marko · 0 comments
Owner
<?php
        $params = array(
           'path' => '/home/upload',
           'create_parents' => 'true',
           'overwrite' => 'true',
           'api' => 'SYNO.FileStation.Upload',
           'version' => 2,
           'method' => 'upload'
           '_sid' => [id of session after authenticate],
           'file[]' => "@".path_to_file
        );

        $ch = curl_init();

        $BODY = http_build_query($params);
        curl_setopt($ch, CURLOPT_URL, 'http://ip_of_diskstation:5000/entry.cgi');
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $BODY);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        $result = curl_exec($ch);
        $info = curl_getinfo($ch);
        curl_close($ch);

        var_dump($result);
    ?>
``` <?php $params = array( 'path' => '/home/upload', 'create_parents' => 'true', 'overwrite' => 'true', 'api' => 'SYNO.FileStation.Upload', 'version' => 2, 'method' => 'upload' '_sid' => [id of session after authenticate], 'file[]' => "@".path_to_file ); $ch = curl_init(); $BODY = http_build_query($params); curl_setopt($ch, CURLOPT_URL, 'http://ip_of_diskstation:5000/entry.cgi'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $BODY); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); var_dump($result); ?> ```
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: FHEM/mod-backupToStorage#1
No description provided.