I want to write a code to determine the homepage content was change,
but if the homepage is write by asp or something else, (e.g. livescore.com
here)
i can't get the real homepage content by the following code,
what can i do?
if it is not related to c#
which newsgroup should i post to?
using System;
using System.Net;
using System.IO;
using System.Collecti ons.Generic;
using System.Text;
namespace Web
{
class Program
{
static void Main(string[] args)
{
string RateHTML = "";
string tempHTML = "";
for (int i = 0; i < 10; )
{
try
{
// Download the data to a buffer.
WebClient client = new WebClient();
Byte[] RateHP =
client.Download Data("http://www.livescore.c om/default.dll?pag e=home");
RateHTML = Encoding.ASCII. GetString(RateH P);
// Download the data to a file.
client.Download File("http://www.livescore.c om/default.dll?pag e=home",
"check.txt" );
}
catch (WebException webEx)
{
Console.WriteLi ne(webEx.ToStri ng());
if (webEx.Status == WebExceptionSta tus.ConnectFail ure)
{
Console.WriteLi ne("Are you behind a firewall? If
so, go through the proxy server.");
}
}
DateTime TimeNow = DateTime.Now;
if (tempHTML != RateHTML)
{
Console.WriteLi ne("Score change {0,1}:{1,2}{2,5 }",
TimeNow.Minute % 10, TimeNow.Second, TimeNow.Millise cond);
tempHTML = RateHTML;
}
else
{
Console.WriteLi ne("Unchange {0,1}:{1,2}{2,5 }",
TimeNow.Minute % 10, TimeNow.Second, TimeNow.Millise cond);
}
i++;
}
} // end Main
}
}
but if the homepage is write by asp or something else, (e.g. livescore.com
here)
i can't get the real homepage content by the following code,
what can i do?
if it is not related to c#
which newsgroup should i post to?
using System;
using System.Net;
using System.IO;
using System.Collecti ons.Generic;
using System.Text;
namespace Web
{
class Program
{
static void Main(string[] args)
{
string RateHTML = "";
string tempHTML = "";
for (int i = 0; i < 10; )
{
try
{
// Download the data to a buffer.
WebClient client = new WebClient();
Byte[] RateHP =
client.Download Data("http://www.livescore.c om/default.dll?pag e=home");
RateHTML = Encoding.ASCII. GetString(RateH P);
// Download the data to a file.
client.Download File("http://www.livescore.c om/default.dll?pag e=home",
"check.txt" );
}
catch (WebException webEx)
{
Console.WriteLi ne(webEx.ToStri ng());
if (webEx.Status == WebExceptionSta tus.ConnectFail ure)
{
Console.WriteLi ne("Are you behind a firewall? If
so, go through the proxy server.");
}
}
DateTime TimeNow = DateTime.Now;
if (tempHTML != RateHTML)
{
Console.WriteLi ne("Score change {0,1}:{1,2}{2,5 }",
TimeNow.Minute % 10, TimeNow.Second, TimeNow.Millise cond);
tempHTML = RateHTML;
}
else
{
Console.WriteLi ne("Unchange {0,1}:{1,2}{2,5 }",
TimeNow.Minute % 10, TimeNow.Second, TimeNow.Millise cond);
}
i++;
}
} // end Main
}
}
Comment