Closed dadastudio closed 9 years ago
getClientIP() returns ::1, what is $_SERVER[ 'REMOTE_ADDR' ].
Hi,
The problem is that your local server address is 127.0.0.1 or localhost, or even ::1.
Since your PHP server is running locally it only knows about your local IP address, which of course can't be resolved to a country.
About the "isValidVATNumber" issue - what ia the response? It can either throw an exception or return true/false.
Thank you for a quick response. The problem was that I wanted to echo the result and when vat was invalid it echoed nothing. It works correctly with if.
Thanks. And excuse me for bothering. :)
No problem :)
Hi,
I try to make use of VatCalculator in Laravel but got this error when running locally:
ErrorException in VatCalculator.php line 136: file_get_contents(http://ip2c.org/::1): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
when I run:
$countryCode = VatCalculator::getIPBasedCountry();
I think I installed it correctly because this works: VatCalculator::calculate( 10.00, 'PL' );
Also VatCalculator::isValidVATNumber('NL 123456789 B01'); returns nothing.
Thx.