views:

20

answers:

1

i am developing a application to make reservation and searching on www.hostelclub.com from my website. for that i have got a library and API Document. but both are in php. please give me a download link from where i can download it API library and docuemnt.

+1  A: 

from code below we can ping HostelsClub in asp.net:

    string targetUri = "http://www.hostelspoint.com/xml/xml.php";
    System.Xml.XmlDocument reqDoc = new System.Xml.XmlDocument();
    reqDoc.Load(Server.MapPath("~\\ping.xml"));
    string formParameterName = "OTA_request";
    string xmlData = reqDoc.InnerXml;
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(targetUri);
    string sendString = formParameterName + "=" + HttpUtility.UrlEncode(xmlData);
    //string sendString =  HttpUtility.UrlEncode(xmlData);

    byte[] byteStream;
    byteStream = System.Text.Encoding.UTF8.GetBytes(sendString);
    request.Method = "POST";
    request.ContentType = "application/x-www-form-urlencoded";
    request.ContentLength = byteStream.LongLength;

    using (Stream writer = request.GetRequestStream())
    {
        writer.Write(byteStream, 0, (int)request.ContentLength);
        writer.Flush();
    }

    HttpWebResponse resp = (HttpWebResponse)request.GetResponse();
    string respStr = "";
    if (request.HaveResponse)
    {
        if (resp.StatusCode == HttpStatusCode.OK || resp.StatusCode == HttpStatusCode.Accepted)
        {
            StreamReader respReader = new StreamReader(resp.GetResponseStream());
            respStr = respReader.ReadToEnd(); // get the xml result in the string object  

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(respStr);
            Label1.Text = doc.InnerXml.ToString();


        }
    }  
Rajesh Rolen- DotNet Developer