private const string _site = "https://www.fdworlds.net/";
private const string _login = "";
private const string _passw = "";
private CookieContainer _cookie = new CookieContainer();
private string POST(string _site, string _data, string _referer)
{
HttpWebRequest postRequest = (HttpWebRequest) WebRequest.Create(_site);
{
postRequest.Method = "POST";
postRequest.Timeout = 100000;
postRequest.Host = "www.fdworlds.net";
postRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0";
postRequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
postRequest.Referer = _referer;
postRequest.CookieContainer = _cookie;
postRequest.ContentType = "application/x-www-form-urlencoded";
byte[] sentData = Encoding.GetEncoding(1251).GetBytes(_data);
postRequest.ContentLength = sentData.Length;
Stream sendStream = postRequest.GetRequestStream();
sendStream.Write(sentData, 0, sentData.Length);
sendStream.Close();
}
WebResponse resp = postRequest.GetResponse();
Stream ReceiveStream = resp.GetResponseStream();
StreamReader sr = new StreamReader(ReceiveStream, Encoding.GetEncoding(1251));
Char[] read = new Char[256];
int count = sr.Read(read, 0, 256);
string Out = String.Empty;
while (count > 0)
{
String str = new String(read, 0, count);
Out += str;
count = sr.Read(read, 0, 256);
}
return Out;
}
private string GET(string _site, string _data, string _referer)
{
HttpWebRequest getRequest = (HttpWebRequest) WebRequest.Create(_site + "?" + _data);
{
getRequest.Method = "GET";
getRequest.Host = "www.fdworlds.net";
getRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0";
getRequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
if (_referer != null)
getRequest.Referer = _referer;
getRequest.CookieContainer = _cookie;
}
WebResponse resp = getRequest.GetResponse();
Stream ReceiveStream = resp.GetResponseStream();
StreamReader sr = new StreamReader(ReceiveStream, Encoding.GetEncoding(1251));
Char[] read = new Char[256];
int count = sr.Read(read, 0, 256);
string Out = String.Empty;
while (count > 0)
{
String str = new String(read, 0, count);
Out += str;
count = sr.Read(read, 0, 256);
}
return Out;
}
public Form1()
{
InitializeComponent();
}
private void btnConnect_Click(object sender, EventArgs e)
{
txb_text.Text = POST(_site + "enter.php", "login=" + _login + "&pass=" + _passw, "https://www.fdworlds.net/auth.php");
txb_text.Text = GET(_site + "inv_user.php", " ", "http://www.fdworlds.net/inv_user.php");
}
}
}