Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
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
Posted
Updated 6-Apr-11 22:50pm
v3
Comments
Dalek Dave 7-Apr-11 4:50am    
Edited for Grammar, Syntax and Spelling.

1 solution

I think you can find your solution here:
http://msdn.microsoft.com/en-us/library/ms150046.aspx[^]
 
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