fillup / walmart-partner-api-sdk-php

PHP client for Walmart Partner APIs
MIT License
37 stars 51 forks source link

Getting error during fetching all item #33

Closed jnitishkr closed 7 years ago

jnitishkr commented 7 years ago

Hi,

I am trying to fetch all item but i am getting error "Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error response [url] https://marketplace.walmartapis.com/v2/items?sku=&limit=5&offset=0 [status code] 401 [reason phrase] Unauthorized' in /home/jvgtechc/public_html/platformconnection/walmart-partner-api-sdk-php-develop/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:89 Stack trace: #0 /home/jvgtechc/public_html/platformconnection/walmart-partner-api-sdk-php-develop/vendor/guzzlehttp/guzzle/src/Subscriber/HttpError.php(33): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Message\Request), Object(GuzzleHttp\Message\Response)) #1 /home/jvgtechc/public_html/platformconnection/walmart-partner-api-sdk-php-develop/vendor/guzzlehttp/guzzle/src/Event/Emitter.php(108): GuzzleHttp\Subscriber\HttpError->onComplete(Object(GuzzleHttp\Event\CompleteEvent), 'complete') #2 /home/jvgtechc/public_html/platformconnection/walmart-partner-api-sdk-php-develop/vendor/guzzlehttp/guzzle/src/RequestFsm.php(91): GuzzleHttp\Event\ in /home/jvgtechc/public_html/platformconnection/walmart-partner-api-sdk-php-develop/vendor/guzzlehttp/command/src/AbstractClient.php on line 172".

Please help me to figure out this issue.

fillup commented 7 years ago

Hi @nitishvap can you provide some more information about your set up? Can you share the snippet of code of how you're using the SDK as well as what version of PHP and the operating system you are running on? Do you get the same error for other API calls as well?

jnitishkr commented 7 years ago

Hi,

I have attached my code . So please check and let me know.

Thanks NITISH KR Jha

On Dec 15, 2016 19:50, "Phillip Shipley" notifications@github.com wrote:

Hi @nitishvap https://github.com/nitishvap can you provide some more information about your set up? Can you share the snippet of code of how you're using the SDK as well as what version of PHP and the operating system you are running on? Do you get the same error for other API calls as well?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fillup/walmart-partner-api-sdk-php/issues/33#issuecomment-267338362, or mute the thread https://github.com/notifications/unsubscribe-auth/AXXjcNPtZ3ZxyNODYMgbM1Ab1CSsvPj8ks5rIUyagaJpZM4LJ2vi .

<?php //error_reporting(0); //echo $_SERVER['DOCUMENT_ROOT']; include DIR . '/vendor/autoload.php';

use Walmart\Item; use GuzzleHttp\Command\Exception\CommandClientException; use Sil\PhpEnv\Env; //echo getenv('REMOTE_ADDR'); //echo getenv('...'); die();

$client = new Item([ 'consumerId' => '...', 'privateKey' => '...' ]);

// print_r($client);

$items = $client->list([ // 'sku' => '', // optional 'limit' => 5, // optional, default is 20 'offset' => 0, //optional, default is 0 ]);

echo "

"; print_r($items);

fillup commented 7 years ago

@nitishvap I edited your comment to remove your consumerId and privateKey, you should never post those in a public place. You should also immediately go to the partner portal and regenerate your private key.

Otherwise your code looks like it should work. What operation system and version are you using? What PHP version are you using? Do you have a network time service running on the server to keep time in sync with an internet time server? On linux this is usually the ntpd process.

jnitishkr commented 7 years ago

Hi, I am using "fillup/walmart-partner-api-sdk-php": "1.0.0" and "fillup/walmart-auth-signature-php": "^1.0.3",.

php version: 5.6.21and you can chek my php server detail by link (https://www.platformconnection.net/phpinfo.php)

fillup commented 7 years ago

Ok, update your composer.json to require "fillup/walmart-partner-api-sdk-php": "^1.0.9" and do a composer update. That'll get you the latest version of this SDK. Also, you should not host a phpinfo page publicly, so I'd recommend you take that down too as it can expose too much information about your server. After updating the version in composer and trying again, if you still have problems figure out how to re-sync your ntp.

jnitishkr commented 7 years ago

Hi,

When i am trying to download fillup/walmart-partner-api-sdk-php by shell command then it is showing error ....

I have attached my composer.json

please check and let me know. composer.txt

jnitishkr commented 7 years ago

Hi, I have updated version 1.0.9 but it is still showing same error.

I have updated by shell command in my localhost and paste all code in live server.

Will it work or not?

If not then how to get vendor file from blue host server. It means that how will i run "composer" command in blue host server.

fillup commented 7 years ago

Hmm, looks like you took my composer.json file, added itself as a dependency and are trying to install with that. Try replacing your composer.json file with just the following and run composer install again:

{
  "require": {
    "fillup/walmart-partner-api-sdk-php": "^1.0.9"
  }
}
jnitishkr commented 7 years ago

Hi,

I have updated with same JSON code as you mentioned but still it is producing same error.

Can you provide me full code?

On Dec 21, 2016 03:01, "Phillip Shipley" notifications@github.com wrote:

Hmm, looks like you took my composer.json file, added itself as a dependency and are trying to install with that. Try replacing your composer.json file with just the following and run composer install again:

{ "require": { "fillup/walmart-partner-api-sdk-php": "^1.0.9" } }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fillup/walmart-partner-api-sdk-php/issues/33#issuecomment-268365068, or mute the thread https://github.com/notifications/unsubscribe-auth/AXXjcK1Na2uYERCPx937ekkwWa3FzAFKks5rKEkVgaJpZM4LJ2vi .