Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It seems as though the country and currency selection are stored in cookies.</p> <p><img src="https://i.stack.imgur.com/pJupv.png" alt="enter image description here"></p> <p>I'm assuming you're going to have to pass those values along with your <code>file_get_contents()</code> call. See: <a href="https://stackoverflow.com/questions/3431160/php-send-cookie-with-file-get-contents">PHP - Send cookie with file_get_contents</a></p> <p><br/> <strong>EDIT #1</strong></p> <p>To follow up on my comment, I just tested this:</p> <pre><code>// Create a stream $opts = array( 'http'=&gt;array( 'method'=&gt;"GET", 'header'=&gt;"Accept-language: en\r\n" . "Cookie: CURRENCYPREFERENCE=cad\r\n" ) ); $context = stream_context_create($opts); // Open the file using the HTTP headers set above $file = file_get_contents('http://www.nastygal.com/accessories/minnie-bow-clutch', false, $context); print_r($file); </code></pre> <p>And was able to get this:</p> <p><img src="https://i.stack.imgur.com/1r7Un.png" alt="enter image description here"></p> <p><br/> <strong>EDIT #2:</strong></p> <p>In response to your second comment. Those were important details. What does your bookmarklet do with the scraped contents? Are you saving a copy of the bookmarked product page on your own website? Regardless, you're going to have to modify your bookmarklet to check the user's cookies before submitting the request to run <code>file_get_contents()</code>.</p> <p>I was able to access my cookies from nastygal.com using the following simple bookmarklet example. Note: nastygal.com uses jQuery and the jQuery UI cookie plugin. If you're looking for a more generic solution, you should not rely on these scripts being there:</p> <pre><code>javascript:(function(){ console.log($.cookie('CURRENCYPREFERENCE')); }()); </code></pre> <p>Output in the JS console:</p> <pre><code>cad </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload