Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $invoice = array(
- "logo" => "test.dev", // url to logo
- "from" => "Wouter van Marrum \n<a href=\"http://www.concept-core.nl\">concept-core.nl</a>", // The name of your organization
- "to" => "marleen", // The entity being billed - multiple lines ok
- "number" => 20001, // Invoice number
- //"purchase_order" => "", // Purchase order number
- "date" => null, // Invoice date
- "due_date" => null, // Invoice due date
- "payment_terms" => null, // Payment terms summary (i.e. NET 30)
- // items
- "items[0][name]" => "Website",
- "items[0][quantity]" => 1,
- "items[0][unit_cost]" => 300,
- "items[1][name]" => "logo",
- "items[1][quantity]" => 1,
- "items[1][unit_cost]" => 150,
- // End items
- // Fields
- "fields[tax]" => true, // can be true, false
- "fields[discounts]" => false, // Subtotal discounts - numbers only
- "fields[shipping]" => false, // Can be true or false
- // End fields
- "tax"=> 21, // Tax - numbers only
- "amount_paid" => 0, // Amount paid - numbers only
- "notes" => "", // Notes - any extra information not included elsewhere
- "terms" => "Lees dit", // Terms and conditions - all the details
- );
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "https://invoice-generator.com");
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 ); // AGREGADO POR MI
- curl_setopt($ch, CURLOPT_POSTFIELDS, $invoice);
- $result = curl_exec($ch);
- //header('Content-Length: ' . $response->getHeader('Content-Length')[0]);
- //$file = $result->getBody();
- header('Cache-Control: public');
- header('Content-type: application/pdf');
- header('Content-Disposition: attachment; filename="new.pdf"');
- header('Content-Length: '.strlen($result));
- echo $result;
- curl_close($ch);
Add Comment
Please, Sign In to add comment