Oara\Network\Publisher\DirectTrack::call PHP Method

call() private method

private call ( $apiUrl )
    private function call($apiUrl)
    {
        $headers[] = "Authorization: Basic " . \base64_encode($this->_username . ":" . $this->_password);
        // Initiate the REST call via curl
        $ch = \curl_init($apiUrl);
        // Set the HTTP method to GET
        \curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
        // Add the headers defined above
        \curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        // Don't return headers
        \curl_setopt($ch, CURLOPT_HEADER, false);
        // Return data after call is made
        \curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        // Execute the REST call
        $response = \curl_exec($ch);
        $data = \simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA);
        $json = \json_encode($data);
        $array = \json_decode($json, true);
        // Close the connection
        \curl_close($ch);
        return $array;
    }