theITvideos Posted August 3, 2010 Share Posted August 3, 2010 Hi there, This forum has been helpful to me so far. I'd like to thank you for your help. Now the question is, we will be using xe.com services for our shopping cart and prices. Based to the customer's location the currency must change. For example, if the customer is sitting in Europe, the currency for the product and the shopping cart will be displayed in Euros, similarly for the US customers it will be in USD. I would like to know how we can do this using xe.com and what steps are required. Any comments/feedbacks are always welcome! Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/209700-how-to-integrate-xecom-into-a-website/ Share on other sites More sharing options...
xcoderx Posted August 3, 2010 Share Posted August 3, 2010 detect their country through ip2country db and then show their currency maybe? Quote Link to comment https://forums.phpfreaks.com/topic/209700-how-to-integrate-xecom-into-a-website/#findComment-1094733 Share on other sites More sharing options...
theITvideos Posted August 3, 2010 Author Share Posted August 3, 2010 Thanks for the reply. I have heard that we can integrate using some xe.com Data feeds. Guys kindly give your feedbacks on this one. How do we integrate in the website. What are the simple basic steps. Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/209700-how-to-integrate-xecom-into-a-website/#findComment-1094743 Share on other sites More sharing options...
dezkit Posted August 3, 2010 Share Posted August 3, 2010 Use GeoIP to grab people's location through there ip address then Use SimpleXML to parse the currency through the xe.com website Quote Link to comment https://forums.phpfreaks.com/topic/209700-how-to-integrate-xecom-into-a-website/#findComment-1094748 Share on other sites More sharing options...
theITvideos Posted August 3, 2010 Author Share Posted August 3, 2010 Thanks for the message. I am running on WAMP server. I am trying this now. <?php $country = geoip_country_code_by_name('www.example.com'); echo $country; if ($country) { echo 'This host is located in: ' . $country; } ?> Now this gives errors like: Fatal error: Call to undefined function geoip_country_code_by_name() in C:\wamp\www\test\demo.php on line 7 I guess i need to install PECL thats what it says in the installation section of geoip_country_code_by_name() function. Has anyone installed PECL on WAMP Server or anyone faced problem using this function: geoip_country_code_by_name() for getting users country name? Please reply. Best regards! Quote Link to comment https://forums.phpfreaks.com/topic/209700-how-to-integrate-xecom-into-a-website/#findComment-1094773 Share on other sites More sharing options...
dezkit Posted August 3, 2010 Share Posted August 3, 2010 Put GeoIP.dat and GeoIP.inc in your folder Quote Link to comment https://forums.phpfreaks.com/topic/209700-how-to-integrate-xecom-into-a-website/#findComment-1094812 Share on other sites More sharing options...
theITvideos Posted August 4, 2010 Author Share Posted August 4, 2010 Thanks for the reply. I put in my folder the 2 files you mentioned that is, GeoIP.dat and GeoIP.inc: GeoIP.dat downloaded from: http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz GeoIP.inc downloaded from http://geolite.maxmind.com/download/geoip/api/php/geoip.inc After I included the above 2 files in the folder, I included their references in my .php file: <?php include("geoip.inc"); include("GeoIP.dat"); ?> But I get an error, I noticed that the function geoip_country_code_by_name() which is defined in geoip.inc file, takes two arguments: function geoip_country_name_by_name($gi, $name) { $country_id = geoip_country_id_by_name($gi,$name); if ($country_id !== false) { return $gi->GEOIP_COUNTRY_NAMES[$country_id]; } return false; } Where as in the PHP user guide, they have demonstrated using single argument: <?php $country = geoip_country_code_by_name('www.example.com'); if ($country) { echo 'This host is located in: ' . $country; } ?> Source: http://www.php.net/manual/en/function.geoip-country-code-by-name.php How can we go about fixing this. Any comments of feedback is always welcome. Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/209700-how-to-integrate-xecom-into-a-website/#findComment-1094974 Share on other sites More sharing options...
theITvideos Posted October 14, 2010 Author Share Posted October 14, 2010 Use GeoIP to grab people's location through there ip address then Use SimpleXML to parse the currency through the xe.com website Thank you for your reply. I can now detect the visitors country and can tell which country the user is coming from thru the IP address. Now I just need the second step, that is, using the xe.com Datafeed in my website for currency conversions. All the rates are stored in Australian Dollars in the Database. I just need to convert them (using xe.com datafeed) to visitors country. How can I integrate the xe.com Datafeed my on PHP website. Any sample or working code or something that you can refer to me that I can look at just to get some idea. Thank you very much! All comments and feedbacks are always welcomed! Quote Link to comment https://forums.phpfreaks.com/topic/209700-how-to-integrate-xecom-into-a-website/#findComment-1122173 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.