You are on page 1of 2

HttpWebRequest req = (HttpWebRequest)HttpWebRequest.

Create("http://c
lientes.movilgate.com/suscripciones/");
req.Method = "GET";
req.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
1.9.2.17) Gecko/20110420 Firefox/3.6.17";
req.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,
*/*;q=0.8";
req.Headers.Add("Accept-Language", "en-us,en;q=0.5");
req.KeepAlive = true;
req.Headers.Add("Accept-Encoding", "gzip,deflate");
req.Headers.Add("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream responseStream = resp.GetResponseStream();
StreamReader streamReader = new StreamReader(responseStream);
char[] readBuffer = new char[256];
int cout = 0;
string outputData = "";
do
{
count = streamReader.Read(readBuffer, 0, 256);
outputData = new string(readBuffer, 0, count);
Console.Write(outputData);
} while (count > 0);
responseStream.Close();
streamReader.Close();

CookieAwareWebClient client = new CookieAwareWebClient();


client.Headers.Add("User-Agent", "Mozilla/5.0 (Windows; U; Windows N
T 5.1; en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17");
client.Headers.Add("Accept", "text/html,application/xhtml+xml,applic
ation/xml;q=0.9,*/*;q=0.8");
client.Headers.Add("Accept-Language", "en-us,en;q=0.5");
client.Headers.Add("Accept-Encoding", "gzip,deflate");
client.Headers.Add("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7
");
client.Headers.Add("Keep-Alive", "115");
string ret = client.DownloadString("http://clientes.movilgate.com/su
scripciones/");
string[] parameters = new string[]{"User-Agent: Mozilla/5.0 (Windows
; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*
/*;q=0.8",
"Accept-Language: en-us,en;q=0.5",
"Accept-Encoding: gzip,deflate",
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"Keep-Alive: 115",
"Connection: keep-alive",
"Referer: http://clientes.movilgate.com/suscripciones/",
"Content-Type: application/x-www-form-urlencoded"};
foreach (string header in parameters)
{
string []headvalue = header.Split(new string[]{": "}, StringSpli
tOptions.None);
client.Headers.Add(headvalue[0], headvalue[1]);
}
byte[] bret = client.UploadData("http://clientes.movilgate.com/suscr
ipciones/index.php", "POST",
System.Text.Encoding.ASCII.GetBytes("username=susganado&password
=iniganado&submit=Ingresar"));
string sret = System.Text.Encoding.ASCII.GetString(bret);
parameters = new string[]{"User-Agent: Mozilla/5.0 (Windows; U; Wind
ows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*
/*;q=0.8",
"Accept-Language: en-us,en;q=0.5",
"Accept-Encoding: gzip,deflate",
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"Keep-Alive: 115",
"Connection: keep-alive",
"Referer: http://clientes.movilgate.com/suscripciones/"};
foreach (string header in parameters)
{
string[] headvalue = header.Split(new string[] { ": " }, StringS
plitOptions.None);
client.Headers.Add(headvalue[0], headvalue[1]);
}
string ret2 = client.DownloadString("http://clientes.movilgate.com/s
uscripciones/admin.php");
parameters = new string[]{"User-Agent: Mozilla/5.0 (Windows; U; Wind
ows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*
/*;q=0.8",
"Accept-Language: en-us,en;q=0.5",
"Accept-Encoding: gzip,deflate",
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"Keep-Alive: 115",
"Connection: keep-alive",
"Referer: http://clientes.movilgate.com/suscripciones/admin.php"
};
foreach (string header in parameters)
{
string[] headvalue = header.Split(new string[] { ": " }, StringS
plitOptions.None);
client.Headers.Add(headvalue[0], headvalue[1]);
}
string ret3 = client.DownloadString("http://clientes.movilgate.com/s
uscripciones/logout.php");
HttpWebRequest request = (HttpWebRequest) HttpWebRequest.Create("htt
p://clientes.movilgate.com/suscripciones/");
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse) request.GetResponse();