This is my problem. I explain:
I use Firefox. If I set the browser language to English, the following page displays text in Spanish, but the currency in dollars. Link
The same URL, If I set the browser language to Spanish, the texts are displayed in Spanish and currency in Euros.
I created a script with PHP using JSON: How I can set the language for calls? The following code, ALWAYS returns the English language:
<?php
$url = "http://steamcommunity.com/market/search/render/?l=spanish&start=0&count=20¤cy=3&category_730_Weapon%5B%5D=tag_weapon_awp&appid=730&query=Man-o%27-war";
$json_object= file_get_contents($url);
$json_decoded = json_decode($json_object);
//precios
preg_match_all('/<span style="color:white">(.*)<\/span>/',$json_decoded->results_html, $sor);
foreach($sor[1] as $k => $v)
{
echo $v."<br/>";
}
?>
I want the currency Euros. I tried adding the following modifications, but the currency result is always English:
<html lang="es">
<head>
<meta http-equiv="Content-Language" content="es"/>
</head>
<body>
<?php
$locale = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']);
echo $locale."<br/>";
$options = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: es\r\n" .
"Cookie: foo=bar\r\n")
);
$context = stream_context_create($options);
$url = "http://steamcommunity.com/market/search/render/?l=spanish&start=0&count=20¤cy=3&category_730_Weapon%5B%5D=tag_weapon_awp&appid=730&query=Man-o%27-war";
$json_object= file_get_contents($url,false,$context);
$json_decoded = json_decode($json_object);
//precios
preg_match_all('/<span style="color:white">(.*)<\/span>/',$json_decoded->results_html, $sor);
foreach($sor[1] as $k => $v)
{
echo $v."<br/>";
}
?>
</body>
</html>
Thank you for your help. Greetings.