1

I am trying to access data of an e-commerce website of another country. The problem is that different data is displayed in different countries. I want to access the data from the UAE. My server is in the USA and I guess the data is fetched as if my application is running the code from outside UAE. How do I make it look like it runs from UAE.

I am fetching this data using the following code

<?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\r\n" .
              "Cookie: foo=bar\r\n" . 
              "User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36\r\n"
            // 'ignore_errors' => true
        )
    );
    $context = stream_context_create($opts);
    $html = file_get_contents($link, false, $context);
    echo $html;
?>

Can I set my code to run from UAE? Thanks in advance

  • Have you looked at the geolocation http header? – Trebor May 9 '19 at 23:26
  • @Trebor How do I add a geolocation HTTP header to the above code( I have updated the question with the code) – Abdulla May 10 '19 at 4:16
  • @Abdulla Questions about coding are considered off-topic here. Your other related question was migrated to Stack Overflow for the same reason, which is the proper site for asking code related questions on. – dan May 10 '19 at 4:56