by pietman
14. May 2012 07:03
http://oreilly.com/windows/archive/csharp-regular-expressions.html
http://www.mikesdotnetting.com/Article/46/CSharp-Regular-Expressions-Cheat-Sheet
TESTER
simple example:
const string LocalLinkRegex = @"href=""\/livechess\/game\.html\?id\=(?<GameId>[0-9]*)""";
var R2 = new Regex(LocalLinkRegex, RegexOptions.ExplicitCapture);
var Matches2 = R2.Matches(result);
string href;
string FirstGameIdValue = Matches2[0].Groups["GameId"].Value;
/*
this will find: /livechess/game.html?id=123456789
and return: 123456789 (which is token: GameId)
*/
849472af-07fb-46e3-89bb-a4a46adecfa7|0|.0
Tags:
by pietman
12. May 2012 16:51
File.WriteAllText("dump.html", response);
2cb03480-7a57-49e9-8cde-9b0d421fcfce|0|.0
Tags:
by pietman
12. May 2012 16:46
var cookies = new CookieContainer();
ServicePointManager.Expect100Continue = false;
var request = (HttpWebRequest)WebRequest.Create("http://www.hotfile.com/login.php");
request.CookieContainer = cookies;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
using (var requestStream = request.GetRequestStream())
using (var writer = new StreamWriter(requestStream))
{
writer.Write("user=XX&pass=XX&returnto=/");
}
using (var responseStream = request.GetResponse().GetResponseStream())
using (var reader = new StreamReader(responseStream))
{
var result = reader.ReadToEnd();
Console.WriteLine(result);
}
604411a5-c537-4f32-a5b3-3e781cd5dc84|0|.0
Tags:
c#