十二月
29
2014

VAT number verify

驗證VAT號碼是否有效的簡易小程式

function checkVAT($vatNumber) {
    $_vatCountry = strtoupper(substr($vatNumber, 0, 2));
    $_vatNumber  = substr($vatNumber, 2);

    $client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
    $checkRes = $client->checkVat(array(
			'countryCode' => $_vatCountry,
			'vatNumber' => $_vatNumber
    ));

    return $checkRes;
}

About the Author: 阿維

阿維雜記本的偷懶維護者

Comments are closed.