Kasutaja tarvikud

Lehe tööriistad



et:xmlcore

Erinevused

Siin näed erinevusi valitud versiooni ja hetkel kehtiva lehekülje vahel.

Lõlita võrdlemise vaatele

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
et:xmlcore [2015/08/24 18:20] ottet:xmlcore [2021/08/30 15:15] – [Sisend] ott
Rida 39: Rida 39:
  
 Terve tootebaasi päring: Terve tootebaasi päring:
-https://directo.gate.ee/xmlcore/demo_ee/xmlcore.asp?get=1&what=item&key=20DAF3F822B782AF12D1198C23F45604+https://login.directo.ee/xmlcore/demo_ee/xmlcore.asp?get=1&what=item&key=20DAF3F822B782AF12D1198C23F45604
  
 Üksiku toote päring, toote koodi järgi, lisaparameeter ''code=0000'': Üksiku toote päring, toote koodi järgi, lisaparameeter ''code=0000'':
-https://directo.gate.ee/xmlcore/demo_ee/xmlcore.asp?get=1&what=item&code=0000&key=20DAF3F822B782AF12D1198C23F45604+https://login.directo.ee/xmlcore/demo_ee/xmlcore.asp?get=1&what=item&code=0000&key=20DAF3F822B782AF12D1198C23F45604
  
 ====Andmete saatmine Directosse ehk sisend==== ====Andmete saatmine Directosse ehk sisend====
Rida 57: Rida 57:
 <wrap important>Käesolevas näites toodud URLid ja XML sõnumid on täiesti fiktiivsed ja pole teenuse testimiseks kasutatavad. Testimine toimub alati reaalse installatsiooni suhtes.</wrap> <wrap important>Käesolevas näites toodud URLid ja XML sõnumid on täiesti fiktiivsed ja pole teenuse testimiseks kasutatavad. Testimine toimub alati reaalse installatsiooni suhtes.</wrap>
  
-Oletame, et liidese URL on antud juhul https://directo.gate.ee/xmlcore/this_is_the_worlds_greatest_company/xmlcore.asp+Oletame, et liidese URL on antud juhul https://login.directo.ee/xmlcore/this_is_the_worlds_greatest_company/xmlcore.asp
  
 Andmeid kirjeldab schema {{:et:xml_in_arved.xsd|}} Andmeid kirjeldab schema {{:et:xml_in_arved.xsd|}}
Rida 108: Rida 108:
  
  
-====PHP näide====+====PHP näited==== 
 +===Väljund===
 <code php> <code php>
 +$url = 'https://directo.gate.ee/xmlcore/demo_ee/xmlcore.asp?get=1&what=item&key=20DAF3F822B782AF12D1198C23F45604';
 +
 +$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, 0);
 +
 +$result = curl_exec($ch);
 +
 +header('Content-Type: text/html; charset=utf-8');
 +
 +print '<textarea cols=80 rows=10>' . $result . '</textarea>';
 +
 +$data = new SimpleXMLElement($result);
 +
 +print '<pre>';
 +
 +foreach ($data->items->item as $item) {
 + print $item['Code'] . chr(9) .  '<b>' . $item['Name'] . '</b>' . chr(9) .  $item['Class'] . '<br>';
 + foreach ($item->datafields->data as $df ) {
 + print chr(9) . $df['code'] . ':' . $df['content'] . '<br>';
 + }
 +}
 +</code>
 +
 +
 +===Sisend===
 +<code php>
 +
 +
 +$url = 'https://login.directo.ee/xmlcore/demo_ee/xmlcore.asp';
 +$key = '2852DD553B767B463C807ADB36B5BB2F';
  
 $xmldata = <<<XML $xmldata = <<<XML
-<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="utf-8"?> 
-<invoice AppKey="1234567879012345678790InvoiceNr="123 +<items> 
- InvoiceDate="2015-06-07CustomerCode="CUST001"> +  <item code="LMP0001name="Lambikasclass="LAMPbarcode="123456789" salesprice="11.25" description="See on suur lamp" > 
-    <lines+    <datafields
-      <line ProductID="KILLERPRODUCTQuantity="3" UnitPriceWoVAT="123.45"/> +      <data code="ART_VARVcontent="Punane" /> 
-      <line ProductID="FREESAMPLEQuantity="1" UnitPriceWoVAT="0.00"/> +      <data code="VEEBIScontent="Jah" /> 
-    </lines+    </datafields
-  </invoice>+  </item> 
 +</items>
 XML; XML;
-$url = 'https://directo.gate.ee/xmlcore/this_is_the_worlds_greatest_company/xmlcore.asp'; 
  
 $ch = curl_init(); $ch = curl_init();
 +
 curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_HEADER, 0);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 +curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
 curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_URL, $url );
 curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POST, 1);
 +#curl_setopt($ch, CURLOPT_VERBOSE, 1);
 +#curl_setopt($ch, CURLOPT_HEADER, 1);
 +#curl_setopt($ch, CURLINFO_HEADER_OUT, true);
 +curl_setopt($ch, CURLOPT_POSTFIELDS, 'key='.urlencode($key).'&xmldata='.urlencode($xmldata).'&put=1&what=item' );
  
-curl_setopt($ch, CURLOPT_POSTFIELDS, 'xmldata='.urlencode($xmldata).'&put=1&what=contract' );  
 $result = curl_exec($ch); $result = curl_exec($ch);
 +curl_close($ch);
  
-print '<textarea cols=80 rows=10>' . $result . '</textarea>';+echo '<pre>';
  
-curl_close($ch); +print '</pre><textarea cols=80 rows=10>'$result . '</textarea>';
-</code>+
  
 +</code>
et/xmlcore.txt · Viimati muutnud: 2024/04/16 09:19 persoon toomas

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki