targa.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. $targa = isset($_GET["targa"]) ? $_GET["targa"] : '';
  3. $targa = "VA050AG";
  4. try{
  5. $wd = "dettaglioAutoveicoloBase";
  6. $wd = "datiCartaCircolazioneAutoveicoloProprietario";
  7. $url = 'https://www.ilportaledellautomobilista.it/Info-ws/services';
  8. $url = 'http://e-servizicoll.dtt.ilportaledellautomobilista.it/Info-ws-sh/services';
  9. $client = new \SoapClient($url . '/' . $wd . '/' . $wd . '.wsdl', array(
  10. 'stream_context' => stream_context_create(array(
  11. 'ssl' => array(
  12. 'verify_peer' => false,
  13. 'verify_peer_name' => false,
  14. 'allow_self_signed' => true
  15. )
  16. )),
  17. 'trace' => 1
  18. ));
  19. $utente = 'CMRM001301';
  20. $password = '2PMPM*89';
  21. $utente = 'PRFR000191';
  22. $password = 'TEST.001';
  23. $xml = '<wsse:Security
  24. xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
  25. SOAP-ENV:mustUnderstand="1">
  26. <wsse:UsernameToken
  27. xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
  28. wsu:Id="XWSSGID-1253605895203984534550">
  29. <wsse:Username>' . $utente . '</wsse:Username>
  30. <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">' . $password . '</wsse:Password>
  31. </wsse:UsernameToken>
  32. </wsse:Security>';
  33. $header = new \SoapHeader(
  34. 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd',
  35. 'Security',
  36. new \SoapVar($xml, XSD_ANYXML),
  37. true
  38. );
  39. $client->__setSoapHeaders($header);
  40. $classe = "dettaglioAutoveicoloBase";
  41. $classe = "dettaglioCartaCircolazioneProprietarioAutoveicolo";
  42. try {
  43. $obj = $client->__soapCall($classe, array(
  44. $classe . "Request" => array(
  45. "login" => array(),
  46. "targa" => array("numeroTarga" => $targa),
  47. "pdf" => false
  48. )
  49. ));
  50. echo "<h3>RESPONSE OBJECT</h3>";
  51. print '<pre>';
  52. print_r($obj);
  53. print '</pre>';
  54. echo "<hr><h3>SOAP REQUEST HEADERS</h3>";
  55. echo "<pre>" . htmlspecialchars($client->__getLastRequestHeaders()) . "</pre>";
  56. echo "<h3>SOAP REQUEST</h3>";
  57. echo "<pre>" . htmlspecialchars($client->__getLastRequest()) . "</pre>";
  58. echo "<hr><h3>SOAP RESPONSE HEADERS</h3>";
  59. echo "<pre>" . htmlspecialchars($client->__getLastResponseHeaders()) . "</pre>";
  60. echo "<h3>SOAP RESPONSE</h3>";
  61. echo "<pre>" . htmlspecialchars($client->__getLastResponse()) . "</pre>";
  62. } catch (\SoapFault $fault) {
  63. $x = $fault->getMessage();
  64. echo "<h3>SOAP ERROR</h3>";
  65. echo $fault->getMessage();
  66. echo "<h3>Last SOAP Request</h3>";
  67. echo "<pre>" . htmlspecialchars($client->__getLastRequest()) . "</pre>";
  68. }
  69. /*
  70. try {
  71. $this->loadTarga = "OK";
  72. $obj = $client->__soapCall($classe, array(
  73. $classe . "Request" => array(
  74. "login" => array(),
  75. "targa" => array("numeroTarga" => $targa),
  76. "pdf" => false
  77. )
  78. ));
  79. print_r($obj);
  80. } catch (\SoapFault $fault) {
  81. $this->loadTarga = $fault->getMessage();
  82. }
  83. */
  84. } catch (\Exception $ex) {
  85. print($ex->getMessage());
  86. }
  87. ?>