But in case anyone is interested, then here's my first stab at some code to do it:
CookieContainer cookies = new CookieContainer();
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(
string.Format("https://secure-nikeplus.nike.com/services/profileService?action=login&login={0}&password={1}&locale=en_us",
"your user name here",
"your password here"));
request.CookieContainer = cookies;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Stream s = response.GetResponseStream();
StreamReader reader = new StreamReader(s);
string text = reader.ReadToEnd();
}
HttpWebRequest requestRunList = (HttpWebRequest)WebRequest.Create(
"https://secure-nikeplus.nike.com/nikeplus/v1/services/app/run_list.jhtml");
requestRunList.CookieContainer = cookies;
using (HttpWebResponse responseRunList = (HttpWebResponse)requestRunList.GetResponse())
{
Stream s = responseRunList.GetResponseStream();
StreamReader reader = new StreamReader(s);
string text = reader.ReadToEnd();
Debug.WriteLine(text);
}
HttpWebRequest requestRun = (HttpWebRequest)WebRequest.Create(string.Format(
"https://secure-nikeplus.nike.com/nikeplus/v1/services/app/get_run.jhtml?id={0}",
"pick a run from the run list retrieved above"
));
requestRun.CookieContainer = cookies;
using (HttpWebResponse responseRun = (HttpWebResponse)requestRun.GetResponse())
{
Stream s = responseRun.GetResponseStream();
StreamReader reader = new StreamReader(s);
XmlSerializer xmlS = new XmlSerializer(typeof(plusService));
plusService plusService = (plusService)xmlS.Deserialize(reader);
Debug.WriteLine("status = " + plusService.status);
Debug.WriteLine("datatype = " + plusService.sportsData.extendedDataList.extendedData.dataType);
Debug.WriteLine("intervaltype = " + plusService.sportsData.extendedDataList.extendedData.intervalType);
Debug.WriteLine("intervalUnit = " + plusService.sportsData.extendedDataList.extendedData.intervalUnit);
Debug.WriteLine("intervalValue = " + plusService.sportsData.extendedDataList.extendedData.intervalValue);
string[] items = plusService.sportsData.extendedDataList.extendedData.Value.Split(',');
foreach (string item in items)
Debug.WriteLine("\t" + item);
}
}
Note: maybe I should explain and expand upon this a bit better - I will when I tidy up the code a bit!
this is one of the most informative and useful site
ReplyDeleteIT trends
The blog is marvelous and enthusiastic.First time i visit your blog and love it.I ll also tell my
ReplyDeletefriends to visit your blog and read it........................
Software Solution