C#: How to read data from webbrowser in a windows application

c++http

First of all i am doing a Windows application. Not a web application.

Now i am doing on application to send SMS (Short message) from System to Mobile.

Here, i am using a http URL to push the message having parameters To (number) and Msg (test message).

after forming the URL, like

http://333.33.33.33:3333/csms/PushURL.cgi?USERNAME=xxxx&PASSWORD=xxxx&MOBILENO=919962391144&MESSAGE=TestMessage&TYPE=0&CONTENT_TYPE=text;

Here i mentioned 3 for ip address, X for passwords and user id because of confidential.

After sending this URL, i am receiving some text like "Message Send Successfully", in the browser window.

Just i want to read the text and store in the database.

My problem is: how can i read the text from the web browser.

please held me!

Best Solution

Using .NET , see WebClient Class - Provides common methods for sending data to and receiving data from a resource identified by a URI.

Seen here a few times, e.g. fastest c# code to download a web page

EDIT: the System.Net.WebClient class is not connected to web applications, and can be easily used in console or winforms applications. The C# example in the MSDN link is a standalone console app (compile and run it to check):

using System;
using System.Net;
using System.IO;

public class Test
{
public static void Main (string[] args)
{
    if (args == null || args.Length == 0)
    {
        throw new ApplicationException ("Specify the URI of the resource to retrieve.");
    }
    WebClient client = new WebClient ();

    client.Headers.Add ("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");

    Stream data = client.OpenRead (args[0]);
    StreamReader reader = new StreamReader (data);
    string s = reader.ReadToEnd ();
    Console.WriteLine (s);
    data.Close ();
    reader.Close ();
}

}