Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function index2()
- {
- $consumerKey = 'kfkhypveth1upv6f4uwy5l9r7tdwmdp0';
- $consumerSecret = 't9ire4rup8wre5gbbqt3ic2q2snb6ogs';
- $accessToken = '9alfh5bntatd0gk3lwdjxv972erppnmk';
- $accessTokenSecret = 'rxmvwjrb9r8qq2hy0e2ijdytk2srrhmc';
- $method = 'GET';
- $status_field = "searchCriteria[filterGroups][0][filters][0][field]=status";
- $status_value = "searchCriteria[filterGroups][0][filters][0][value]=pending";//
- $status_condition = "searchCriteria[filterGroups][0][filters][0][condition_type]=eq";
- $sc = $status_field . '&' . $status_value . '&' . $status_condition;
- $url = "http://127.0.0.1:8080/mg1/index.php/rest/V1/orders/?".$sc;
- $data = [
- 'oauth_consumer_key' => $consumerKey,
- 'oauth_nonce' => md5(uniqid(rand(), true)),
- 'oauth_signature_method' => 'HMAC-SHA1',
- 'oauth_timestamp' => time(),
- 'oauth_token' => $accessToken,
- 'oauth_version' => '1.0',
- ];
- $data['oauth_signature'] = $this->sign($method, $url, $data, $consumerSecret, $accessTokenSecret);
- $curl = curl_init();
- curl_setopt_array($curl, [
- CURLOPT_RETURNTRANSFER => 1,
- CURLOPT_URL => $url,
- CURLOPT_HTTPHEADER => [
- 'Authorization: OAuth ' . http_build_query($data, '', ',')
- ]
- ]);
- $result = curl_exec($curl);
- curl_close($curl);
- echo '<pre>';
- print_r(json_decode($result,false));
- }//end of function
- stdClass Object
- (
- [message] => Invalid signature
- [trace] => #0 C:wamp64wwwmg1vendormagentoframeworkOauthOauth.php(121): MagentoFrameworkOauthOauth->_validateSignature(Array, 't9ire4rup8wre5g...', 'GET', 'http://127.0.0....', 'rxmvwjrb9r8qq2h...')
- #1 C:wamp64wwwmg1vendormagentomodule-webapiModelAuthorizationOauthUserContext.php(82): MagentoFrameworkOauthOauth->validateAccessTokenRequest(Array, 'http://127.0.0....', 'GET')
- #2 C:wamp64wwwmg1vendormagentomodule-authorizationModelCompositeUserContext.php(78): MagentoWebapiModelAuthorizationOauthUserContext->getUserId()
- #3 C:wamp64wwwmg1vendormagentomodule-authorizationModelCompositeUserContext.php(57): MagentoAuthorizationModelCompositeUserContext->getUserContext()
- #4 C:wamp64wwwmg1vendormagentomodule-webapiModelWebapiRoleLocator.php(45): MagentoAuthorizationModelCompositeUserContext->getUserId()
- #5 C:wamp64wwwmg1vendormagentoframeworkAuthorization.php(47): MagentoWebapiModelWebapiRoleLocator->getAclRoleId()
- #6 C:wamp64wwwmg1vendormagentoframeworkInterceptionInterceptor.php(74): MagentoFrameworkAuthorization->isAllowed('Magento_Sales::...', NULL)
- #7 C:wamp64wwwmg1vendormagentoframeworkInterceptionChainChain.php(70): MagentoFrameworkAuthorizationInterceptor->___callParent('isAllowed', Array)
- #8 C:wamp64wwwmg1vendormagentoframeworkInterceptionChainChain.php(63): MagentoFrameworkInterceptionChainChain->invokeNext('Magento\Framewo...', 'isAllowed', Object(MagentoFrameworkAuthorizationInterceptor), Array, 'customerAuthori...')
- #9 C:wamp64wwwmg1vendormagentomodule-customerModelPluginCustomerAuthorization.php(58): MagentoFrameworkInterceptionChainChain->MagentoFrameworkInterceptionChain{closure}('Magento_Sales::...', NULL)
- #10 C:wamp64wwwmg1vendormagentoframeworkInterceptionChainChain.php(67): MagentoCustomerModelPluginCustomerAuthorization->aroundIsAllowed(Object(MagentoFrameworkAuthorizationInterceptor), Object(Closure), 'Magento_Sales::...', NULL)
- #11 C:wamp64wwwmg1vendormagentoframeworkInterceptionInterceptor.php(138): MagentoFrameworkInterceptionChainChain->invokeNext('Magento\Framewo...', 'isAllowed', Object(MagentoFrameworkAuthorizationInterceptor), Array, 'guestAuthorizat...')
- #12 C:wamp64wwwmg1vendormagentomodule-webapiModelPluginGuestAuthorization.php(38): MagentoFrameworkAuthorizationInterceptor->MagentoFrameworkInterception{closure}('Magento_Sales::...', NULL)
- #13 C:wamp64wwwmg1vendormagentoframeworkInterceptionInterceptor.php(142): MagentoWebapiModelPluginGuestAuthorization->aroundIsAllowed(Object(MagentoFrameworkAuthorizationInterceptor), Object(Closure), 'Magento_Sales::...')
- #14 C:wamp64wwwmg1vargenerationMagentoFrameworkAuthorizationInterceptor.php(26): MagentoFrameworkAuthorizationInterceptor->___callPlugins('isAllowed', Array, Array)
- #15 C:wamp64wwwmg1vendormagentoframeworkWebapiAuthorization.php(37): MagentoFrameworkAuthorizationInterceptor->isAllowed('Magento_Sales::...')
- #16 C:wamp64wwwmg1vendormagentomodule-webapiControllerRestRequestValidator.php(86): MagentoFrameworkWebapiAuthorization->isAllowed(Array)
- #17 C:wamp64wwwmg1vendormagentomodule-webapiControllerRestRequestValidator.php(70): MagentoWebapiControllerRestRequestValidator->checkPermissions()
- #18 C:wamp64wwwmg1vendormagentomodule-webapiControllerRestInputParamsResolver.php(80): MagentoWebapiControllerRestRequestValidator->validate()
- #19 C:wamp64wwwmg1vendormagentomodule-webapiControllerRest.php(299): MagentoWebapiControllerRestInputParamsResolver->resolve()
- #20 C:wamp64wwwmg1vendormagentomodule-webapiControllerRest.php(216): MagentoWebapiControllerRest->processApiRequest()
- #21 C:wamp64wwwmg1vargenerationMagentoWebapiControllerRestInterceptor.php(37): MagentoWebapiControllerRest->dispatch(Object(MagentoFrameworkAppRequestHttp))
- #22 C:wamp64wwwmg1vendormagentoframeworkAppHttp.php(135): MagentoWebapiControllerRestInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
- #23 C:wamp64wwwmg1vendormagentoframeworkAppBootstrap.php(258): MagentoFrameworkAppHttp->launch()
- #24 C:wamp64wwwmg1index.php(39): MagentoFrameworkAppBootstrap- >run(Object(MagentoFrameworkAppHttp))
- #25 {main}
- $url = "http://127.0.0.1:8080/mg1/index.php/rest/V1/orders/1";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement