Site icon Hip-Hop Website Design and Development

How send get request to external api with username and password

Actually i want to send get request to an api. the response is in xml.
I have tried this

<article>
    <div class="entry-content">
        <?php

        $url = "XXXXXXX";

        $args = array(
            'headers' => array(
                'Authorization' => 'Basic ' . base64_encode( 'username:password' ),
                'Accept' => 'application/xml'
            )
        );

        $res = wp_remote_request(
            $url,
            array(
                'method'    => 'GET',
                'headers'   => $args
            )
        );

        print_r($res);
        ?>  
    </div>
</article>

I have tested the same url in postman and the response from server is coming. but in worpress, its not coming, its giving me 403 Requests_Utility_CaseInsensitiveDictionary data-protected error.

How to solve this please help me.