Click here to Skip to main content
15,900,907 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to get the string "response" from "getxmlresponse" function to use in another function ? and how to convert string to xml and xml to database?
C#
public string getxmlresponse(string ChkRequest)
   {
       string RequestURLString = " http://www.hotelspro.com/xf_3.0/hp_xml_request_parser.php?xml=" + ChkRequest;
       WebRequest wrequest = null;
       try
       {
           string Response = string.Empty;
           wrequest = WebRequest.Create(RequestURLString);
           Stream ResponseStrm = null;
           wrequest.Timeout = 0xea60;
           ResponseStrm = wrequest.GetResponse().GetResponseStream();
           StreamReader Reader = new StreamReader(ResponseStrm);
           try
           {
               Response = Reader.ReadToEnd();
           }
           catch
           {

           }
           return Response;
           ResponseStrm.Close();
           Reader.Close();

    }
       catch (Exception)
       { }
       return "";
   }
Posted
Updated 23-Sep-10 0:25am
v2
Comments
anshudutta 23-Sep-10 3:04am    
Please elaborate your question? You have a function which gets response from a website in string. Is your question - How to convert that string to xml?
Sandeep Mewara 23-Sep-10 6:25am    
Question title is not for asking auestion! :doh:

1 solution

Just call this method to get the string. Use ChkRequest whatever your request id would be and get the Response string.

Use
XDocument.Parse to parse the string into XML. ;)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900