targa.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. $targa = isset($_GET["targa"]) ? $_GET["targa"] : '';
  3. $targa = "FM636CP";
  4. try{
  5. $wd = "dettaglioAutoveicoloBase";
  6. $wd = "datiCartaCircolazioneAutoveicoloProprietario";
  7. $url = 'https://www.ilportaledellautomobilista.it/Info-ws/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. $xml = '<wsse:Security
  21. xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
  22. SOAP-ENV:mustUnderstand="1">
  23. <wsse:UsernameToken
  24. xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
  25. wsu:Id="XWSSGID-1253605895203984534550">
  26. <wsse:Username>' . $utente . '</wsse:Username>
  27. <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">' . $password . '</wsse:Password>
  28. </wsse:UsernameToken>
  29. </wsse:Security>';
  30. $header = new \SoapHeader(
  31. 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd',
  32. 'Security',
  33. new \SoapVar($xml, XSD_ANYXML),
  34. true
  35. );
  36. $client->__setSoapHeaders($header);
  37. $classe = "dettaglioAutoveicoloBase";
  38. $classe = "dettaglioCartaCircolazioneProprietarioAutoveicolo";
  39. try {
  40. $obj = $client->__soapCall($classe, array(
  41. $classe . "Request" => array(
  42. "login" => array(),
  43. "targa" => array("numeroTarga" => $targa),
  44. "pdf" => false
  45. )
  46. ));
  47. echo "<h3>RESPONSE OBJECT</h3>";
  48. print_r($obj);
  49. echo "<hr><h3>SOAP REQUEST HEADERS</h3>";
  50. echo "<pre>" . htmlspecialchars($client->__getLastRequestHeaders()) . "</pre>";
  51. echo "<h3>SOAP REQUEST</h3>";
  52. echo "<pre>" . htmlspecialchars($client->__getLastRequest()) . "</pre>";
  53. echo "<hr><h3>SOAP RESPONSE HEADERS</h3>";
  54. echo "<pre>" . htmlspecialchars($client->__getLastResponseHeaders()) . "</pre>";
  55. echo "<h3>SOAP RESPONSE</h3>";
  56. echo "<pre>" . htmlspecialchars($client->__getLastResponse()) . "</pre>";
  57. } catch (\SoapFault $fault) {
  58. $this->loadTarga = $fault->getMessage();
  59. echo "<h3>SOAP ERROR</h3>";
  60. echo $fault->getMessage();
  61. echo "<h3>Last SOAP Request</h3>";
  62. echo "<pre>" . htmlspecialchars($client->__getLastRequest()) . "</pre>";
  63. }
  64. /*
  65. try {
  66. $this->loadTarga = "OK";
  67. $obj = $client->__soapCall($classe, array(
  68. $classe . "Request" => array(
  69. "login" => array(),
  70. "targa" => array("numeroTarga" => $targa),
  71. "pdf" => false
  72. )
  73. ));
  74. print_r($obj);
  75. } catch (\SoapFault $fault) {
  76. $this->loadTarga = $fault->getMessage();
  77. }
  78. */
  79. } catch (\Exception $ex) {
  80. print($ex->getMessage());
  81. }
  82. ?>