Čia matote skirtumus tarp pasirinktos versijos ir esamo dokumento.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
lt:xmlcore [2020/07/13 13:20] robertas |
lt:xmlcore [2020/07/13 13:22] robertas |
||
---|---|---|---|
Linija 35: | Linija 35: | ||
https://directo.gate.ee/xmlcore/demo_ee/xmlcore.asp?get=1&what=item&code=0000&key=20DAF3F822B782AF12D1198C23F45604 | https://directo.gate.ee/xmlcore/demo_ee/xmlcore.asp?get=1&what=item&code=0000&key=20DAF3F822B782AF12D1198C23F45604 | ||
- | *PHP pavyzdys* | + | **PHP pavyzdys** |
<code> | <code> | ||
$url = 'https://directo.gate.ee/xmlcore/demo_ee/xmlcore.asp?get=1&what=item&key=20DAF3F822B782AF12D1198C23F45604'; | $url = 'https://directo.gate.ee/xmlcore/demo_ee/xmlcore.asp?get=1&what=item&key=20DAF3F822B782AF12D1198C23F45604'; | ||
Linija 97: | Linija 97: | ||
</code> | </code> | ||
+ | |||
+ | **PHP pavyzdys** | ||
+ | <code> | ||
+ | $xmldata = '<'.'?xml version="1.0" encoding="UTF-8"?> | ||
+ | <invoice AppKey="1234567879012345678790" InvoiceNr="123" | ||
+ | InvoiceDate="2015-06-07" CustomerCode="CUST001"> | ||
+ | <lines> | ||
+ | <line ProductID="KILLERPRODUCT" Quantity="3" UnitPriceWoVAT="123.45"/> | ||
+ | <line ProductID="FREESAMPLE" Quantity="1" UnitPriceWoVAT="0.00"/> | ||
+ | </lines> | ||
+ | </invoice>'; | ||
+ | |||
+ | $url = 'https://directo.gate.ee/xmlcore/this_is_the_worlds_greatest_company/xmlcore.asp'; | ||
+ | |||
+ | $ch = curl_init(); | ||
+ | curl_setopt($ch, CURLOPT_HEADER, 0); | ||
+ | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||
+ | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); | ||
+ | curl_setopt($ch, CURLOPT_URL, $url ); | ||
+ | curl_setopt($ch, CURLOPT_POST, 1); | ||
+ | |||
+ | curl_setopt($ch, CURLOPT_POSTFIELDS, 'xmldata='.urlencode($xmldata).'&put=1&what=invoice' ); | ||
+ | $result = curl_exec($ch); | ||
+ | |||
+ | print '<textarea cols=80 rows=10>' . $result . '</textarea>'; | ||
+ | |||
+ | curl_close($ch); | ||
+ | |||
+ | </code> | ||
Servisas sinchroninškai grąžins XML atsakymą su pranešimu kas įvyko. | Servisas sinchroninškai grąžins XML atsakymą su pranešimu kas įvyko. | ||
Linija 132: | Linija 161: | ||
:!: Svarbu sulaukti atsakymo apie sėkmingą įkėlimą. Jeigu tokio rezultato nesulaukiama arba yra gaunama klaida, siuntimą reikia pakartoti ne anksčiau kaip po minutės. | :!: Svarbu sulaukti atsakymo apie sėkmingą įkėlimą. Jeigu tokio rezultato nesulaukiama arba yra gaunama klaida, siuntimą reikia pakartoti ne anksčiau kaip po minutės. | ||
- | ==== 2.3. HMTL forma ==== | + | ==== 2.3. HTML forma ==== |
Parametrai, kuriuos reikia nurodyti: | Parametrai, kuriuos reikia nurodyti: |