Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "route4me/route4me-php",
"description": "Access Route4Me's logistics-as-a-service API using our PHP SDK",
"minimum-stability": "stable",
"version": "1.3.1",
"version": "1.3.2",
"authors": [
{
"name": "Igor Route4Me",
Expand Down
18 changes: 12 additions & 6 deletions src/Route4Me/Route4Me.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,19 @@ public static function makeRequst($options)

$ch = curl_init();

$url = isset($options['url'])
? $options['url'] . '?' . http_build_query(array_merge(
$query,
['api_key' => self::getApiKey()]
)) : '';

$baseUrl = self::getBaseUrl();
$host = parse_url($baseUrl . (isset($options['url']) ? $options['url'] : ''), PHP_URL_HOST);
$url = null;
if (isset($host) && strtolower(substr($host, 0, 2)) == "wh") {
$url = (isset($options['url']) ? $options['url'] . '?' . http_build_query($query) : '');
$headers[] = 'Authorization: Bearer ' . self::getApiKey();
} else {
$url = (isset($options['url'])
? $options['url'] . '?' . http_build_query(array_merge(
$query,
['api_key' => self::getApiKey()]
)) : '');
}

$curlOpts = [
CURLOPT_URL => $baseUrl.$url,
Expand Down