need equivalent PHP (HttpWebRequest and Stream or curl) code for this .net code
<p>i got a problem in PHP. i want to get all the bus stations in india. so i have made an xml request and post that xml data to given API URL. but i did not get the result. below is the .net code which is working fine. even i have used the "HttpRequest" method in php, but it gives me an error like "Fatal error: Class 'HttpRequest' not found".</p>

<p>can anybody help me to give me the equivalent code in php or possible ways to get the data..?</p>

<p>thanks in advance.</p>

<h1>.net code (working fine)</h1>

<pre><code>protected void getBusServices(string journeydate)
{

        XmlDocument doc = new XmlDocument();
        StringReader stream;
        StreamReader reader;
        XmlTextReader textreader;
        HttpWebRequest req;
        HttpWebResponse response;
        try
        {

            string password = "password";
            DateTime dt = Convert.ToDateTime(journeydate);
            string strJrneyDate = dt.ToString("MM-dd-yyyy");
            string strRtDate = dt.AddDays(3).ToString("MM-dd-yyyy");
            string url = Bus_Api_Url;


             string RequestCommand = "&lt;Command&gt;GET_STATIONS&lt;/Command&gt; &lt;Username&gt;username&lt;/Username&gt; &lt;Password&gt;password&lt;/Password&gt;";
            req = (HttpWebRequest)WebRequest.Create(url);
            string RequestData = "RequestXML=&lt;?xml version='1.0' encoding='utf-8' ?&gt;&lt;BusRequest  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'&gt;" + RequestCommand + "&lt;/BusRequest&gt;";
            req.Method = WebRequestMethods.Http.Post;
            req.ContentLength = RequestData.Length;
            req.ContentType = "application/x-www-form-urlencoded";
            using (StreamWriter writer = new StreamWriter(req.GetRequestStream()))
            {
                writer.Write(RequestData);
            }
            response = (HttpWebResponse)req.GetResponse();
            Stream responsestream = response.GetResponseStream();
            reader = new StreamReader(responsestream);
            string xmlresponse = reader.ReadToEnd();
            stream = new StringReader(xmlresponse);
            textreader = new XmlTextReader(stream);
            doc.LoadXml(xmlresponse);
            DataSet ds = new DataSet();
            ds.ReadXml(textreader);


        }

        catch (Exception ex)
        {
            EBUtils.Logger.LogError.Publish(ex);
        }
        finally
        {
            reader = null;
            // stream = null;
            reader = null;
            response = null;
            doc = null;
        }
    }

}
</code></pre>
