I am running an application which fetches data from amazon.ae. I use the code below.
<?php
$link = 'https://www.amazon.ae/Huawei-P20-Pro-Dual-SIM/dp/B07MMQRNYT/ref=sr_1_3?keywords=huawei&qid=1557457063&s=electronics&sr=1-3';
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en
" .
"Cookie: foo=bar
" .
"User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
"
// 'ignore_errors' => true
)
);
$context = stream_context_create($opts);
$html = file_get_contents($link, false, $context);
echo $html;
?>
My server is located in the USA. So the application opens the page as if it is browsing from the USA. This code displays the Amazon.ae page as below
The problem is - this is not how the page is displayed if a user opens the same URL from UAE. The page is displayed as below if opened from UAE.
You can see the 'price' and 'sold by' is different for both locations.
What I want to do is to fetch the page as if my application is running from UAE. How do I make my application run the code from UAE instead of US. Thanks in advance