Skip to content

Instantly share code, notes, and snippets.

@neil-s
Created November 7, 2013 02:13
Show Gist options
  • Save neil-s/7347810 to your computer and use it in GitHub Desktop.
Save neil-s/7347810 to your computer and use it in GitHub Desktop.
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace RevolutionizeTesting
{
class Program
{
static void Main(string[] args)
{
bool patterncontinues = true;
String accessURL = "http://letsrevolutionizetesting.com/challenge?id=756775492";
while (patterncontinues)
{
int index = accessURL.IndexOf("?");
accessURL = accessURL.Insert(index, ".json");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(accessURL);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
TextReader reader = new StreamReader(response.GetResponseStream());
String responseText = reader.ReadToEnd();
Dictionary<String, String> responsedict = new Dictionary<string, string>();
responsedict = JsonConvert.DeserializeObject<Dictionary<string, string>>(responseText);
try
{
accessURL = responsedict["follow"];
}
catch (KeyNotFoundException)
{
patterncontinues = false;
Console.Write(responseText);
}
}
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment