Skip to content

Commit

Permalink
fixed double api.php in url when complete url is provided (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
sherblot authored Sep 29, 2021
1 parent 2eae27c commit b7f7114
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/WhmcsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ protected function execute(string $method, $parameters = [])
$parameters['action'] = $method;

try {
$url = $this->getConfig()['apiurl'].'/api.php';
$url = $this->getConfig()['apiurl'];
if (!preg_match('/\/api\.php$/i', $url)) {
$url = rtrim($url, '/') . '/api.php';
}

$response = $this->connection()->post($url, [
'form_params' => array_merge($parameters, $this->connection()->getConfig()['form_params']),
]);
Expand Down

0 comments on commit b7f7114

Please sign in to comment.