Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Checks if IHSA JOT semi-finals change. Makes synchronous GET requests and checks if it ever changes.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Media;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace GetJot
{
class Program
{
static void Main(string[] args)
{
var results = "";
for(int i=0; i<360; i++)
{
var current = GetRequest();
if (results != current)
{
SystemSounds.Exclamation.Play();
Console.WriteLine("WOAH " + i);
}
else
{
Console.WriteLine("ok " + i);
}
results = current;
Console.WriteLine("sleep");
System.Threading.Thread.Sleep(30000);
}
}
private static string GetRequest()
{
var request = (HttpWebRequest)WebRequest.Create("http://www.joyoftournaments.com/il/ihsa-deb/info.asp?p=8&_=1489800551661");
request.Method = "GET";
var response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
// Console.WriteLine(responseString);
//Console.ReadLine();
return responseString;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment