Ciao,
ho fatto un pò di ricerche e ho provato ad usare quel webservice tramite SOAP disponibile in PHP5. Ora premettendo che la documentazione realitva a soap di questo webservice è la seguente:
codice:
POST /EmailServices.asmx HTTP/1.1
Host: webservices.tiscali.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://webservices.tiscali.com/IsValidEmail"
codice:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<IsValidEmail xmlns="http://webservices.tiscali.com/">
<email>string</email>
</IsValidEmail>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<IsValidEmailResponse xmlns="http://webservices.tiscali.com/">
<IsValidEmailResult>string</IsValidEmailResult>
</IsValidEmailResponse>
</soap:Body>
</soap:Envelope>
e stando a quanto dice la documentazione io ho scritto questo codice:
Codice PHP:
$client = new SoapClient('http://webservices.tiscali.com/EmailServices.asmx?WSDL');
$result = $client->IsValidEmail("xxx@tiscali.it");
print_r ($result);
perchè ho letto che indicando al costruttore della classe soap l'indirizzo del file WSDL avrò a disposizione le interfacce del webservice come semplici metodi della classe.
Ma la cosa non funziona. Ottengo questo tipo di errore:
Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. --> Object reference not set to an instance of an object. in C:\Programmi\Apache Software Foundation\Apache2.2\htdocs\GestioneDatabase\SoapC lient.php:13 Stack trace: #0 [internal function]: SoapClient->__call('IsValidEmail', Array) #1 C:\Programmi\Apache Software Foundation\Apache2.2\htdocs\GestioneDatabase\SoapC lient.php(13): SoapClient->IsValidEmail('xxx@t...') #2 {main} thrown in C:\Programmi\Apache Software Foundation\Apache2.2\htdocs\GestioneDatabase\SoapC lient.php on line 13 dove la linea 13 è appunto
Codice PHP:
$result = $client->IsValidEmail("xxx@tiscali.it");
Qualcuno mi può aiutare?
Ciao e grazie!