/** * @param string $number * @param string $country */ public function viesValidation($number, $country) { $db = JFactory::getDBO(); $get = 'vat=' . $number . '&ms=' . $country . '&iso=' . $country . '&lang=EN'; $path = '/taxation_customs/vies/viesquer.do?' . $get; $url = 'http://ec.europa.eu' . $path; $tempprocessor = new processor(); $result = $tempprocessor->transmitRequest($url, $path); if (strpos($result, 'Request time-out') != 0) { return null; } elseif (strpos($result, 'Yes, valid VAT number') != 0) { return true; } else { return false; } }
public function transmitRequest($url, $path, $content = null, $port = 443, $curlextra = null, $header = null) { if (is_array($header)) { if (!isset($header["Content-Type"])) { $header["Content-Type"] = "text/xml"; } } else { $header = array("Content-Type" => "text/xml"); } return parent::transmitRequest($url, $path, $content, $port, $curlextra, $header); }