targa_moto.php 3.3 KB

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