php - How to retrieve orders details from woocommerce using REST API? -


i want orders details woocommerce using rest api. if, tried anything, returns error following: {"code":"woocommerce_rest_cannot_view","message":"sorry, cannot view resource.","data":{"status":401}}

i have tried following,

require __dir__ . '/vendor/autoload.php';  use automattic\woocommerce\client; use automattic\woocommerce\httpclient\httpclientexception;  $woocommerce = new client( 'https://www.domain.com',  'ck_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',  'cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',     [         'version' => 'v3',     ] );  print_r($woocommerce->get('orders')); 

so, please provide suggestion or idea acheive solution. in advance.


Comments

Popular posts from this blog

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -