You are here

private function VatNumberController::connectDatabaseVies in VAT Number 8

Try to connect with the VIES database.

Catch PHP warnings if connection with the host is not possible.

1 call to VatNumberController::connectDatabaseVies()
VatNumberController::__construct in src/Controller/VatNumberController.php

File

src/Controller/VatNumberController.php, line 89

Class

VatNumberController
Defines a controller to validate the VAT Number.

Namespace

Drupal\vat_number\Controller

Code

private function connectDatabaseVies() {
  try {
    return new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl", [
      "exceptions" => 1,
    ]);
  } catch (SoapFault $e) {

    // Connection to host not possible, europe.eu down?
    \Drupal::logger('vat_number')
      ->error($e->faultstring);
    return FALSE;
  }
}