Hello,
the title basically says what my question is. I checked your code for sdk but I still don’t get how to use it to create a client and a bill (the client does not exist yet). I did also check an example form to manage this with curl. However, it makes no sense to me how to make it work together.
What I got now is a HTML <form> and a backend php file which takes the input from the form and a function to process it. For the last step the code is required to add a new client to invoice ninja and add a new invoice to this client.
Are there any other working examples of how to integrate invoice ninja in custom html/php?
I got it with composer.
From command line I can connect to my invoice ninja installation but now with your php-sdk I get the following error:
[Sun Jun 18 10:12:07.549302 2017] [:error] [pid 11104] [client xxx.xxx.xxx.xxx:12345] PHP Fatal error: Uncaught Error: Call to undefined function InvoiceNinja\Models\curl_init() in /var/www/html/vendor/invoiceninja/sdk-php/src/InvoiceNinja/Models/AbstractModel.php:133\nStack trace:\n#0 /var/www/html/vendor/invoiceninja/sdk-php/src/InvoiceNinja/Models/AbstractModel.php(62): InvoiceNinja\Models\AbstractModel::sendRequest(‘https://crm…’, ‘{“contacts”:[{"…’, ‘POST’)\n#1 /var/www/html/index.php(12): InvoiceNinja\Models\AbstractModel->save()\n#2 {main}\n thrown in /var/www/html/vendor/invoiceninja/sdk-php/src/InvoiceNinja/Models/AbstractModel.php on line 133
Ok, now I got it. Works perfect with this API. Thanks.
Just one thing, how does it work with downloading an invoice… right now I get some weired symbols in my browser. How to generate a download (invoice.pdf)?
No, not very good. It works but I just found that if I put the content from the string to a file (with fopen (…) and name this file invoice.pdf, the pdf works. However, this gives me an empty pdf file: