ChadGregory Posted May 6, 2013 Share Posted May 6, 2013 ok I developing a plugin for wordpress and I need to be able to set the location to US, so that when it grabs product information the page that is being requested it brings in US dollars. Currently it is bringing in prices as Yen. <?php if (!function_exists('bb_file_contents')) { function bb_file_contents($url) { if(function_exists('curl_init')) { $ch = curl_init(); $timeout = 0; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, TRUE); $file_contents = curl_exec($ch); if (!$file_contents) { print_r(curl_getinfo($ch)); die; } curl_close($ch); } else { $file_contents = file_get_contents($url); } return $file_contents; } } ?> Anyway of doing this? Or is there another way I can get the pages content for me to preg_match? Quote Link to comment https://forums.phpfreaks.com/topic/277685-set-geolocation-curl_initmock-locations/ Share on other sites More sharing options...
Q695 Posted May 6, 2013 Share Posted May 6, 2013 do a simple math conversion on the price, then output it by multiplying the conversion rate. Quote Link to comment https://forums.phpfreaks.com/topic/277685-set-geolocation-curl_initmock-locations/#findComment-1428532 Share on other sites More sharing options...
ChadGregory Posted May 6, 2013 Author Share Posted May 6, 2013 (edited) do a simple math conversion on the price, then output it by multiplying the conversion rate. I guess I forgot to mention that it would be just the price that would be affected but also the language as well. But its not just the price actually its the actual name of the product to that could change, In the example of Yen as the currency Chinese is the language which would render the whole thing useless. For that I would have to have some way to auto detect the language and translate accordingly, or mock the geolocation of the requestion. But as well this is a plugin for wordpress that could be on a server in any part of the world, so the currency and language would change. I need a in-plugin solution to take this problem out of the equation. Even if you know of a way that use Javascript or java to retrieve the info without geolocation that can send the data to PHP would work as well. But again I have the question how? Edited May 6, 2013 by ChadGregory Quote Link to comment https://forums.phpfreaks.com/topic/277685-set-geolocation-curl_initmock-locations/#findComment-1428536 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.