Skip to content

Commit 71adfd2

Browse files
author
florian030
committed
catch ipv6-connection errors for ec.europa.eu
1 parent 3c19f6d commit 71adfd2

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

interface/lib/classes/validate_client.inc.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,8 @@ function check_vat_id ($field_name, $field_value, $validator){
174174
}
175175
}
176176
}
177-
178-
$client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
179-
180-
if($client){
177+
try {
178+
$client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
181179
$params = array('countryCode' => $cc, 'vatNumber' => $vn);
182180
try{
183181
$r = $client->checkVat($params);
@@ -191,12 +189,12 @@ function check_vat_id ($field_name, $field_value, $validator){
191189
}
192190
}
193191

194-
// This foreach shows every single line of the returned information
195-
/*
196-
foreach($r as $k=>$prop){
197-
echo $k . ': ' . $prop;
198-
}
199-
*/
192+
// This foreach shows every single line of the returned information
193+
/*
194+
foreach($r as $k=>$prop){
195+
echo $k . ': ' . $prop;
196+
}
197+
*/
200198

201199
} catch(SoapFault $e) {
202200
//echo 'Error, see message: '.$e->faultstring;
@@ -217,7 +215,7 @@ function check_vat_id ($field_name, $field_value, $validator){
217215
break;
218216
}
219217
}
220-
} else {
218+
} catch(SoapFault $e){
221219
// Connection to host not possible, europe.eu down?
222220
// this shouldn't be the user's fault, so we return no error
223221
}

0 commit comments

Comments
 (0)