• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: RS!Form pro validated VAT-ID

RS!Form pro validated VAT-ID 4 years 1 month ago #41046

  • uwe.grimm
  • uwe.grimm's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
  • Thank you received: 1
Here is my code for the VAT ID to check, but I am doing something wrong, I always get the message ID wrong.
Thanks in advance.
Uwe

Orginal url: www.ptmr.io/blog/umsatzsteuer-id-nummer-mit-php-prufen
public static function vatID($value, $extra = null, $data = null)
    {
        $vatid = $value; // Hier die zu überprüfende UID-Nummer einsetzen
 
        $vatid = str_replace(array(' ', '.', '-', ',', ', '), '', trim($vatid));
        $cc = substr($vatid, 0, 2);
        $vn = substr($vatid, 2);
        $client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
 
        if($client){
            $params = array('countryCode' => $cc, 'vatNumber' => $vn);
            try{
                $r = $client->checkVat($params);
                if($r->valid == true){
                    return;
                } else {
                    return false;
                }
 
            // Alle Ergebniszeilen durchlaufen lassen und ausgeben
                foreach($r as $k=>$prop){
                    echo $k . ': ' . $prop;
                }
 
            } catch(SoapFault $e) {
                echo 'Error, see message: '.$e->faultstring;
            }
        } else {
            // Verbindungsfehler, WSDL-Datei nicht erreichbar (passiert manchmal)
        }
    }
The administrator has disabled public write access.
The following user(s) said Thank You: manuel.berger
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!