Abdelkarim Posted November 14, 2018 Share Posted November 14, 2018 Hi. I'm develop acces to my whcms via API, but I like use Access Control with Access Key according to Developer Docmentacion Steeps WHMCS 7.6.1 PHP 7.2 Edit my configuration.php and add $api_access_key = 'SECRET_KEY_32_CHAR_ASCII127'; I'm using Guzzle 6 for my develop. $response = $client->get($this->url.self::ENDPOINT, [ 'headers' => [ 'action' => 'GetClients', 'username' => $this->username, // My API credential identifier 'password' => $this->password, // My API credentoal secret 'accesskey' => $this->accesskey, // Acces key on configuration.php 'responsetype' => self::RESPONSE_TYPE // json ] ]); But when I execute code get exception GuzzleHttp\Exception\ClientException : Client error: `GET https://castris.com/intranet/includes/api.php` resulted in a `403 Forbidden` response: result=error;message=Invalid IP 2.137.134.24 What is wrong? 0 Quote Link to comment Share on other sites More sharing options...
Abdelkarim Posted November 14, 2018 Author Share Posted November 14, 2018 An error in understanding the mechanism of sending the parameters, using headers instead of a correct form_params since it is a POST method Correct code is $response = $client->post($this->url.self::ENDPOINT, [ 'form_params' => [ 'action' => 'GetClients', 'identifier' => $this->username, 'secret' => $this->password, 'accesskey' => $this->accesskey, 'responsetype' => self::RESPONSE_TYPE ] ]); 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.