0
내가 유효한 조작합니다 부가가치세를 확인하려면이 코드를 사용하여 작업 VAT 번호 유효성 검사를 조작합니다. 큰 지연을 가져오고 결과를 반환하지 않습니다. 나는 그 문제는 내가이 서비스를 구현하는 또 다른 방법입니다하지
내가 유효한 조작합니다 부가가치세를 확인하려면이 코드를 사용하여 작업 VAT 번호 유효성 검사를 조작합니다. 큰 지연을 가져오고 결과를 반환하지 않습니다. 나는 그 문제는 내가이 서비스를 구현하는 또 다른 방법입니다하지
을 변경할 수 없습니다 내 PHP
(버전 5.3)이라고 생각
index.php를
<?php
require 'VatService.php';
$service = new VatService();
if (!empty($_POST)) {
if (isset($_POST['txt_vat_number'])) $_POST['txt_vat_number'] = trim(str_replace(['.', ' ',], '', $_POST['txt_vat_number']));
try {
$response = $service->checkVat(new CheckVat($_POST['cbo_country'], $_POST['txt_vat_number']));
}catch(Exception $e){
$response = $e->getMessage();
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>CheckVat</title>
<meta charset="UTF-8" />
</head>
<body>
<form method="POST">
<select name="cbo_country">
<option value="BE">Belgium</option>
<option value="NL">Netherlands</option>
</select>
<input type="text" name="txt_vat_number" value="<[email protected]$_POST['txt_vat_number']?>" />
<button type="submit">Lookup</button>
</form>
<?php if (isset($response)) {?>
<div>
<pre><?php print_r($response) ?></pre>
</div>
<?php } ?>
</body>
</html>
VatService.php
<?php
class checkVat {
var $countryCode;//string
var $vatNumber;//string
public function __construct($countryCode, $vatNumber) {
$this->countryCode = $countryCode;
$this->vatNumber = $vatNumber;
}
}
class checkVatResponse {
var $countryCode;//string
var $vatNumber;//string
var $requestDate;//date
var $valid;//boolean
var $name;//string
var $address;//string
}
class checkVatApprox {
var $countryCode;//string
var $vatNumber;//string
var $traderName;//string
var $traderCompanyType;//companyTypeCode
var $traderStreet;//string
var $traderPostcode;//string
var $traderCity;//string
var $requesterCountryCode;//string
var $requesterVatNumber;//string
}
class checkVatApproxResponse {
var $countryCode;//string
var $vatNumber;//string
var $requestDate;//date
var $valid;//boolean
var $traderName;//string
var $traderCompanyType;//companyTypeCode
var $traderAddress;//string
var $traderStreet;//string
var $traderPostcode;//string
var $traderCity;//string
var $traderNameMatch;//matchCode
var $traderCompanyTypeMatch;//matchCode
var $traderStreetMatch;//matchCode
var $traderPostcodeMatch;//matchCode
var $traderCityMatch;//matchCode
var $requestIdentifier;//string
}
class VatService {
var $soapClient;
private static $classmap = array(
'checkVat' =>'checkVat',
'checkVatResponse' =>'checkVatResponse',
'checkVatApprox' =>'checkVatApprox',
'checkVatApproxResponse' =>'checkVatApproxResponse',
);
function __construct($url='http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl') {
$this->soapClient = new SoapClient($url,array("classmap"=>self::$classmap,"trace" => true,"exceptions" => true));
}
function checkVat($checkVat) {
return $this->soapClient->checkVat($checkVat);
}
function checkVatApprox($checkVatApprox) {
return $this->soapClient->checkVatApprox($checkVatApprox);
}
}<?php
class checkVat {
var $countryCode;//string
var $vatNumber;//string
public function __construct($countryCode, $vatNumber) {
$this->countryCode = $countryCode;
$this->vatNumber = $vatNumber;
}
}
class checkVatResponse {
var $countryCode;//string
var $vatNumber;//string
var $requestDate;//date
var $valid;//boolean
var $name;//string
var $address;//string
}
class checkVatApprox {
var $countryCode;//string
var $vatNumber;//string
var $traderName;//string
var $traderCompanyType;//companyTypeCode
var $traderStreet;//string
var $traderPostcode;//string
var $traderCity;//string
var $requesterCountryCode;//string
var $requesterVatNumber;//string
}
class checkVatApproxResponse {
var $countryCode;//string
var $vatNumber;//string
var $requestDate;//date
var $valid;//boolean
var $traderName;//string
var $traderCompanyType;//companyTypeCode
var $traderAddress;//string
var $traderStreet;//string
var $traderPostcode;//string
var $traderCity;//string
var $traderNameMatch;//matchCode
var $traderCompanyTypeMatch;//matchCode
var $traderStreetMatch;//matchCode
var $traderPostcodeMatch;//matchCode
var $traderCityMatch;//matchCode
var $requestIdentifier;//string
}
class VatService {
var $soapClient;
private static $classmap = array(
'checkVat' =>'checkVat',
'checkVatResponse' =>'checkVatResponse',
'checkVatApprox' =>'checkVatApprox',
'checkVatApproxResponse' =>'checkVatApproxResponse',
);
function __construct($url='http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl') {
$this->soapClient = new SoapClient($url,array("classmap"=>self::$classmap,"trace" => true,"exceptions" => true));
}
function checkVat($checkVat) {
return $this->soapClient->checkVat($checkVat);
}
function checkVatApprox($checkVatApprox) {
return $this->soapClient->checkVatApprox($checkVatApprox);
}
}
같은 문제. 큰 지연과 빈 페이지. – gpap13
이 스크립트는 실행 중이며 작동하므로 실제로 서버의 설정으로 보입니다. – DarkBee