Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify file upload #96

Merged
merged 3 commits into from
Jan 21, 2019
Merged

Simplify file upload #96

merged 3 commits into from
Jan 21, 2019

Conversation

andig
Copy link
Owner

@andig andig commented Jan 14, 2019

Fixed #78. Usage example:

#!/usr/bin/env php
<?php

use Andig\FritzBox\Api;

require_once('vendor/autoload.php');

$api = new Api('http://fritz.box', 'foo', 'bar');
echo $api->getSID();

$formfields = array(
    'PhonebookId' => 1
);

$filefields = array(
    'PhonebookImportFile' => array(
        'type' => 'text/xml',
        'filename' => 'updatepb.xml',
        'content' => 'foobarbaz',
    )
);

$result = $api->postFile($formfields, $filefields); // send the command
echo $result;

@andig andig mentioned this pull request Jan 14, 2019
@derwok
Copy link

derwok commented Jan 19, 2019

Hi,
I just checked out jour /api/ branch (this PR) and gave it a test run.
I don't know if this is already ment to work?

On my machine I get this error at the very end:

Converted 138 vCard(s)
Uploading
PHP Fatal error:  Uncaught Error: Call to undefined method Andig\FritzBox\Api::doPostFile() in /home/pi/bin/carddav2fb/src/functions.php:363
Stack trace:
#0 /home/pi/bin/carddav2fb/src/RunCommand.php(95): Andig\upload('<?xml version="...', Array)
#1 /home/pi/bin/carddav2fb/vendor/symfony/console/Command/Command.php(255): Andig\RunCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 /home/pi/bin/carddav2fb/vendor/symfony/console/Application.php(953): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /home/pi/bin/carddav2fb/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Andig\RunCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /home/pi/bin/carddav2fb/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Appli in /home/pi/bin/carddav2fb/src/functions.php on line 363

@andig
Copy link
Owner Author

andig commented Jan 19, 2019

Ja, das muss postFile heissen wie oben geschrieben.

@andig andig merged commit 142656e into master Jan 21, 2019
@andig andig deleted the api branch March 24, 2019 14:02
@andig andig restored the api branch October 18, 2019 18:39
@andig andig deleted the api branch October 18, 2019 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants