0

I am trying to get some pricing information from a website. The website will prompt a window to select country. After selecting a country, the website will set a cookie and will show the data according to that country.

I used file_get_html to parse data from the website. The problem is, It showing default price. So, My question is, Is it possible to set cookie as per we want using the file_get_html or any other way to do it.

The code I am using to parse data from the website are the following.

include_once 'simple_html_dom.php';
$content = "http://www.luluwebstore.com/products/lulu-household-pets-pet-food/purina/purina-dog-chow-little-bites-dry-food-181-kg/pid-8263178.aspx";
$html = file_get_html($content);
echo $price = $html->find('div[class=price_stockdiv_l3]',0);

The result of the above code is:

OUR PRICE : AED 10.00 MRP : AED 11.00 9%off

By default, the website will fetch AED pricing, but, I want the result in QAR pricing. If we are browsing the website first time it will promot a window to select country.

The site following a cookie like the below to save the country. enter image description here

MUHSIN MOHAMED PC
  • 167
  • 1
  • 2
  • 17
  • try "[curl](http://php.net/manual/en/book.curl.php)" – Mohamed Sa'ed Mar 25 '18 at 11:13
  • How to use Curl to set cookie? – MUHSIN MOHAMED PC Mar 25 '18 at 11:26
  • take a look to this [Answer](https://stackoverflow.com/questions/16872082/how-can-i-send-cookies-using-php-curl-in-addition-to-curlopt-cookiefile) - [Answer](https://stackoverflow.com/questions/13028258/sending-cookies-stored-on-cookie-global-using-php-curl) - and if you need any explanation code tell me and i will post answer – Mohamed Sa'ed Mar 25 '18 at 12:05
  • I am still having the same problem. I can't set the cookie. Please give me the answer with code that set location id to as follows in the image. – MUHSIN MOHAMED PC Mar 31 '18 at 09:59

0 Answers0