PHP Integration
Webhook
webhook.php
$content = trim(file_get_contents("php://input"));
$data = json_decode($content);
$fp = fopen('output.txt', 'w');
fwrite($fp, $data);
fclose($fp);
#Serve a file
php -S <server.ip>:9000 webhook.php
#Serve a folder (index required)
cd path/to/your/app
php -S <server.ip>:9000
#running in background
nohup php -S <server.ip>:9000 -t /folder webhook.php > captodocs.log 2>&1 &
Ejemplo de datos guardados en output.txt
output.txt
{
"AccountingUser": "ADMIN",
"Company": "1",
"Department": "1",
"Division": "1",
"Holding": "HOLDING1",
"Journal": "400",
"LocalCurrency": "EUR",
"Monbas": "2",
"Posting": "1",
"Token": "4R33vj9EdJHsdaAE74345fDsW",
"Detail": "1",
"Impost": "1",
"Name": "Alquiler local",
"Pagapu": "1",
"PaymentAutomatic": "0",
"PaymentClacre": "03",
"PaymentOnAccount": "572000003",
"PaymentOnAccountAuxcod": "",
"PaymentOnAccountAuxtip": "",
"SellerAccount": "410000003",
"SellerAuxiliary": "",
"SellerAuxiliaryAuxcod": "",
"SellerConamp": "Alquiler y servicios mes",
"SellerConcep": "02",
"Tipfac": "PR",
"SellerPartyCorporateName": "Alquileres, S.L.",
"SellerAddress": "Av Diagonal, 1234",
"SellerAddressPostCode": "08173",
"SellerAddessTown": "Barcelona",
"SellerTaxIdentification": "B00000000",
"SellerEmail": "seller@email.com",
"SelletTel": "0000000000000",
"InvoiceNumber": "5158",
"InvoiceIssueDate": "20190110",
"BuyerPartyCorporateName": "Empresa, S.L.",
"BuyerAddress": "Av Diagonal, 1234",
"BuyesAddressPostCode": "08173",
"BuyesAddressTown": "Barcelona",
"BuyerAddressProvince": "Barcelona",
"BuyerTaxIdentification": "B00000000",
"Detail1ArticleCode": "Renta Octubre",
"Detail1TotalCost": "819,30",
"Detail2ArticleCode": "Gastos Comunes",
"Detail2TotalCost": "219,59",
"InvoiceTotalsGrossAmount": "1038,89",
"Tax1Rate": "21,00",
"Tax1TotalAmount": "218,17",
"TotalInvoiceAmount": "1257,06",
"Detail1": {
"DetailAccount": "62100001",
"DetailAuxiliary": "",
"DetailAuxiliaryAuxcod": "",
"DetailConamp": "Alquiler",
"DetailConcep": "02",
"DetailCurrency": "EUR"
},
"Detail2": {
"DetailAccount": "62100001",
"DetailAuxiliary": "",
"DetailAuxiliaryAuxcod": "",
"DetailConamp": "Suministros",
"DetailConcep": "02",
"DetailCurrency": "EUR"
},
"Tax1": {
"TaxAccountTax": "47200000",
"TaxAuxapu": "0",
"TaxAuxcod": "",
"TaxAuxtip": "",
"TaxClaopr": "",
"TaxColimp": "1",
"TaxCurrency": "EUR",
"TaxLibreg": "SOP",
"TaxRelaci": "RG",
"TaxType": "1"
},
"TotalInvoice": {
"TotalInvoiceAccounting": "62100001",
"TotalInvoiceAuxapu": "0",
"TotalInvoiceAuxcod": "",
"TotalInvoiceAuxtip": "",
"TotalInvoiceCurrency": "EUR"
}
}
Última actualización
¿Te fue útil?