Functii API

Adaugarea Chitantelor

Metoda de adaugare a documentelor se apeleaza la adresa: https://appv1.facturis-online.ro/facturis/api/add_receipt.php

Se face un POST pe pagina cu urmatorii parametrii:

xml_string – textul xml ce contine datele de logare si datele chitantei



$xml_string='<?xml version="1.0" encoding="ISO-8859-1"?>
<addReceipt>
<login>
<pass>!parola primita de la facturis online!</pass>
</login>
<receipt>
<office>Sediul Social</office>
<series>CCC</series>
<number>14</number>
<issueDate>2013-06-11 08:00:00</issueDate>
<dueDate>2013-06-11</dueDate>
<currency>RON</currency>
<purpose>Contravaloare factura x</purpose>
<client>client</client>
<registerNumber>J/1981/2134</registerNumber>
<taxCode>ro 123455</taxCode>
<address>Adresa</address>
<amount>200.00</amount>
<noOnA4>3</noOnA4>// numar chitante pe A4
<Status>Emisa</Status>
</receipt>
</addReceipt>';


$curl_options = array(
CURLOPT_URL => "https://appv1.facturis-online.ro/facturis/api/add_receipt.php",
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => "xml_string=$xml_string",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_TIMEOUT => 30,
CURLOPT_CONNECTTIMEOUT => 5
);

$curl = curl_init();
curl_setopt_array( $curl, $curl_options );
$result = curl_exec( $curl );


//daca raspunsul este o eroare
if (strrpos($result, "Eroare") !== false){
echo $result;
die;
}

header('Cache-Control: public');
header('Content-type: application/pdf');
//daca se doreste salvata
//header('Content-Disposition: attachment; filename="receipt.pdf"');
//daca se doreste vizualizata
header('Content-Disposition: inline; filename="receipt.pdf"');
header('Content-Length: '.strlen($result));
echo $result;
die;

0
Ultimele articole RO-eFactura: