Well, this is actually a two-part question:
You can use the IdHttp component, which is already available in the Indy package and installed with your Delphi, to get the XML document from the server. To do this, you can call the Get method by passing the address of the XML document as a parameter. You can get the result as a string or stream.
If the server uses authentication, you must first determine which authentication methods it uses; if it uses HTTP authentication, IdHttp already allows you to specify HTTP request parameters by providing the Request property. You can set Username \ Password and other parameters using this property. If it uses cookie authentication, you can associate the cookie manager object with IdHttp and provide the necessary cookie for the server. The server can use the web form for authentication and return a cookie to you or return a session ID. Therefore, it is important to know which authentication method is used by the server.
If you have no idea about the authentication method used by the server, you can ask their support team, or you can install a sniffer, such as Wireshark, and try to connect to the server using a web browser and capture data exchanged between the server and your browser, and analyze it to find out which method is used.
In any case, once you have received the XML data, you can load it into an instance of TXmlDocument using its LoadFromStream method or its XML property.
source share