Hello everyone,
Please let me know how to get part of response generated from the url.
I have written this code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.IO;
namespace Experiment
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string url = "https://api.smscountry.com/smscwebservices_bulk_reports.aspx?
user=xxxx&passwd=xxxx&fromdate=DD/MM/YYYY 00:00:00 &todate=DD/MM/YYYY
23:59:59";
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
httpWebRequest.Method = "POST";
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
Stream responseStream = httpWebResponse.GetResponseStream();
StreamReader streamReader = new StreamReader(responseStream);
string response = streamReader.ReadToEnd();
Response.Write(Response);
}
}
}
I am not sure whether this code will work or not.
What I have done is simply pasted the URL with the parameters it wants in the browser and now the output is generated by this url on simple writing the url in the browser with date stamp, userid and password is:
165276683~919870657048~2~02/04/2011 17:31:00~0.04~~4/2/2011 5:30:50 PM#165277227~919870657048~2~02/04/2011 17:34:00~0.04~~4/2/2011 5:33:47 PM#165281555~919870657048~2~02/04/2011 17:59:00~0.04~~4/2/2011 5:59:09 PM#165287028~919870657048~2~02/04/2011 18:37:00~0.04~~4/2/2011 6:36:38 PM#165449882~919146771088~9~03/04/2011 15:03:00~0.04~~4/3/2011 3:03:13 PM#165461364~919146771088~9~03/04/2011 16:09:00~0.08~~4/3/2011 4:09:46 PM#165461364~919714033112~9~03/04/2011 16:10:00~0.08~~4/3/2011 4:10:30
The format of the output is Response: - jobid~mobilenumber~messagestatus~donestamp~message_text~receivestamp
Now I need only the Mobile number, donestamp from this, how could I do this?
Please , please help me, how to get only part of the response generated by the URL
Thanks & Regards,
Krunal Panchal