Skip to content

Commit 8a87239

Browse files
authored
Handle redundant slashes in ticker config
I.e. `https://api.example.com//ticker/target` becomes `https://api.example.com/ticker/target`
1 parent 6ff468a commit 8a87239

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/classes/tools.class.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,13 @@ public function getApi($url, $target, $auth=NULL) {
4444
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
4545
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
4646
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
47+
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
4748
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; PHP client; '.php_uname('s').'; PHP/'.phpversion().')');
4849
}
49-
curl_setopt($ch, CURLOPT_URL, $url . $target);
50+
51+
$url = rtrim($url, '/');
52+
$target = ltrim($target, '/');
53+
curl_setopt($ch, CURLOPT_URL, $url . '/' . $target);
5054
// curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
5155

5256
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

0 commit comments

Comments
 (0)