protected function getThriftClient($clientClass, $url) { $parts = parse_url($url); if (!isset($parts['port'])) { if ($parts['scheme'] === 'https') { $parts['port'] = 443; } else { $parts['port'] = 80; } } $httpClient = new \THttpClient($parts['host'], $parts['port'], $parts['path'], $parts['scheme']); $httpClient->addHeaders(array('User-Agent' => $this->userAgentId . ' / ' . $this->getSdkVersion() . '; PHP / ' . phpversion())); $thriftProtocol = new \TBinaryProtocol($httpClient); return new $clientClass($thriftProtocol, $thriftProtocol); }