Guest User

Untitled

a guest
Oct 18th, 2024
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.11 KB | None | 0 0
  1. <?PHP
  2.         $wsdl = 'VerificaVoucher2024.wsdl';
  3.         $endpoint = 'https://ws.cartadeldocente.istruzione.it/VerificaVoucherDocWEB/VerificaVoucher';
  4.         $partitaiva = '00000000000';
  5.         $certificato = 'cartadeldocente.pem';
  6.         $password = 'xxxxxxxxxxx';
  7.         $importo = 0;
  8.         $codice = 'xxxxxxx';
  9.        
  10.  
  11.         $client = new SoapClient($wsdl, array('location' => $endpoint,'local_cert' => $certificato,'passphrase' => $password));
  12.        
  13.    
  14.         try
  15.         {
  16.             $result = $client->Check(array('checkReq' => array('tipoOperazione' => 1,'codiceVoucher' => $codice,'partitaIvaEsercente'=>$partitaiva)));
  17.             $result = json_decode(json_encode($result), true);
  18.            
  19.             echo 'operazione riuscita';
  20.  
  21.             $importo = $result['checkResp']['importo'];
  22.            
  23.         } catch(Exception $e) {
  24.  
  25.             echo 'operazione non riuscita';
  26.             die();
  27.         }
  28.        
  29.        
  30.        
  31.         try
  32.         {
  33.             $result = $client->Confirm(array('checkReq' => array('tipoOperazione' => '1','codiceVoucher'  => $codice,'importo'=> $importo)));
  34.             $result = json_decode(json_encode($result), true);
  35.            
  36.             echo 'operazione riuscita';
  37.            
  38.         } catch(Exception $e) {
  39.            
  40.             echo 'Richiesta fallita';
  41.  
  42.         }
  43.        
  44.  
Advertisement
Add Comment
Please, Sign In to add comment