ericpp / nesstocks

NES Classic Stock Checker
3 stars 4 forks source link

Doesn't work on other products #3

Closed jschwalbe closed 7 years ago

jschwalbe commented 7 years ago

Just tried out the script, but switched the UPC to something else (54905488). That number works on brickseek, but gives an error here. Any ideas?

=== Walmart 99654 ===

Fatal error: Uncaught exception 'Exception' with message 'Unable to parse store JSON: HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Encoding: gzip
Content-Length: 169526
Content-Type: text/html; charset=utf-8
Last-Modified: Wed, 26 Jul 2017 02:26:35 GMT
Strict-Transport-Security: max-age=86400
WM_QOS.CORRELATION_ID: 253a5685-deb-15d7cb79d02bcc,253a5685-deb-15d7cb79d0210a,253a5685-deb-15d7cb79d0210a
X-Tb: 1
Expires: Wed, 26 Jul 2017 02:26:35 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Wed, 26 Jul 2017 02:26:35 GMT
Connection: keep-alive
Vary: Accept-Encoding
Set-Cookie: vtc=en05qMdKPboE_pAKziENHQ;Path=/;Domain=.walmart.com;Expires=Mon, 26 Jul 2027 14:26:35 GMT;Max-Age=315576000
Set-Cookie: bstc=en05qMdKPboE_pAKziENHQ;Path=/;Domain=.walmart.com;Expires=Wed, 26 Jul 2017 02:56:35 GMT;Max-Age=1800
Set-Cookie: exp=0%2B1501035992%2Ben05qMdKPboE_pAKziENHQ%2B0%2BBASPM.x4bqf|JWa9b.9Dq6I|MqKR7.FEV4x|VDB_t.W-_fQ|gPk52.-P1gG|thCaU.t9h4_; Path=/; Domain=walmart.com; Expires=Wed, 26 Jul 2017 0 in /Users/ob1/bin/walmart/nesstocks-master/src/WalmartChecker.php on line 34

If it matters, I commented out Target in the config.

jschwalbe commented 7 years ago

Solution:
Commented out the Accept-encoding: gzip. Not sure why that's messing things up. Running macOS Sierra. Thanks for the code!

  public function getStoreInfo($storeId) {
                $headers = array(
                        "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
//                      "Accept-encoding: gzip, deflate, sdch, br",
                        "Accept-language: en-US,en;q=0.8",
                );
ericpp commented 7 years ago

Should be fixed by 04215b3