← Back
Editing: aggiornamento2.php
<?php namespace Unicom\Ricestat; use Unicom\Ricestat\Service\REST; // autoloader include 'autoload.php'; \Unicom_Autoload::register(); \Unicom_Autoload::registerPath( __DIR__ . '/src' ); // init request $src1 = new Source (4, 'smart-ebooking', 'Prova39360'); $src2 = new Source (10, '052032ALB0043', 'password39360'); $rq = new SchedineRQ( $src1, $src2 ); $group = new Gruppo ('1'); // prepare request content $ospite = new Ospite( 168373, '', '' ); // Id, IdCamera, TipoAlloggiato $ospite->setDataDiArrivo( '2016-06-01' ) ->setDataDiPartenza( '2016-06-25' ) ->setCittadinanza( new Cittadinanza( 100000100 ) ) ->setCampiStatistici( new CampiStatistici( TipoTurismo::ALTRO, MezzoDiTrasporto::ALTRO, TipoPrenotazione::ALTRO ) ) ->setImpostaDiSoggiorno( new ImpostaDiSoggiorno( 'MN', '3.50', 7 ) ); $group->setOspite( $ospite ); $ospite = new Ospite( 168371, '', '' ); // Id, IdCamera, TipoAlloggiato $ospite->setDataDiArrivo( '2016-06-01' ) ->setDataDiPartenza( '2016-06-30' ) ->setCittadinanza( new Cittadinanza( 100000100 ) ) ->setCampiStatistici( new CampiStatistici( TipoTurismo::ALTRO, MezzoDiTrasporto::ALTRO, TipoPrenotazione::ALTRO ) ) ->setImpostaDiSoggiorno( new ImpostaDiSoggiorno( 'MN', '3', 6 ) ); $group->setOspite( $ospite ); $groups[] = $group; $xml = $rq->inserimentoAlloggiati ($groups); $arIn = array ("><", "InserimentoAlloggiati>", "<Gruppo IdGruppo=\"1\">\r\n", "</Gruppo>\r\n"); $arOut = array (">\r\n<", "Aggiornamento>", "", ""); $xml = str_replace ($arIn, $arOut, $xml); echo "<p><textarea cols='100' rows='30'>$xml0</textarea></p>"; // generate xml content //$xml = $rq->aggiornamento( $ospite ); file_put_contents( 'xml/aggiornamento.xml', $xml ); // log data // init client and send data to service $rest_cli = new REST\Client(); $rest_cli->setLogFile( __DIR__ . '/logs/aggiornamento.txt' ); $resp = $rest_cli->send( $xml ); print_r( $resp->getError() );
Save File
Cancel