1

I am trying to develop an e-commerce website. To manage multi-currency, I would like to use webservice for automatic conversions. so I tried this webservice: http://www.webservicex.com/CurrencyConvertor.asmx?WSDL with this code :

     try
        {
            $wsdl="http://www.webservicex.com/CurrencyConvertor.asmx?WSDL";
            $webservice = new \SoapClient( $wsdl );

            $country=array();

            // Set the country variable to the country codes.
            $country['FromCurrency']= 'USD';
            $country['ToCurrency'] = 'EUR';

            $webservice->ConversionRate($country);


            echo $response->ConversionRateResult;*/
        }catch(Exception $oException)

        {
            printf(
                '<h4 style="color: Red">Exception</h4>
                <p>%s</p>',
                $oException->getMessage()
            );
        } `

Unfortunately, the service returns me - 1 is there a problem with my code or it's the service that no longer works!!

you know another web service that is stable? thank you very much

strauss
  • 259
  • 3
  • 12

1 Answers1

2

Have a look at

https://openexchangerates.org/

http://fixer.io/

They both have a straight forward API you can integrate to.

m453h
  • 114
  • 1
  • 5
  • ok thank you very much!!! it works.i tried fixer.io with file_get_content(http://api.fixer.io/latest?symbols=EUR,CHF) but my page is slow.is there is an other solution to get result – strauss Feb 08 '16 at 20:56
  • I suspect that you are running your code on your local machine and there is a great chance that your internet connection is slow, Have you tried to test making that webservice call on the actual server you will host your ecommerce website? (Most of these hosting service providers have very decent internet connection setup and you'd hardly notice the overhead when you'll be making the webservice call – m453h Feb 09 '16 at 05:04
  • yes, i tried this morning on my server and the page is correct.thank you for your help!! – strauss Feb 09 '16 at 08:24