Moinax\TvDb\Client::fetchXml PHP Method

fetchXml() protected method

Fetches data via curl and returns result
protected fetchXml ( string $function, array $params = [], string $method = self::GET ) : string
$function string The function used to fetch data in xml
$params array
$method string
return string The data
    protected function fetchXml($function, $params = array(), $method = self::GET)
    {
        if (strpos($function, '.php') > 0) {
            // no need of api key for php calls
            $url = $this->getMirror(self::MIRROR_TYPE_XML) . '/api/' . $function;
        } else {
            $url = $this->getMirror(self::MIRROR_TYPE_XML) . '/api/' . $this->apiKey . '/' . $function;
        }
        $data = $this->httpClient->fetch($url, $params, $method);
        $simpleXml = $this->getXml($data);
        return $simpleXml;
    }