I have a requirement to get cookies from login because i will apply this cookie in the same page. Here is my code
string boundary = "41184676334";
string username = "username";
string password = "password";
string login_post_data =
"POSTDATA=-----------------------------" + boundary +
"\nContent-Disposition: form-data; name=\"login\"" +
"\n\n" + username +
"\n-----------------------------" + boundary +
"\nContent-Disposition: form-data; name=\"key\"" +
"\n\n" + password +
"\n-----------------------------" + boundary +
"\nContent-Disposition: form-data; name=\"clcode\"" +
"\n\n" +
"\n-----------------------------" + boundary + "--";
var cookies = new CookieContainer();
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://site.com/cgi-bin/login.pl?logout");
request.CookieContainer = cookies;
request.Method = "POST";
request.ContentType = "multipart/form-data; boundary=---------------------------" + boundary;
request.Host = "site.com";
request.UserAgent = "Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20100101 Firefox/14.0.1";
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
request.Referer = "https://site.com/cgi-bin/login.pl?logout";
//request.Headers.Add("POSTDATA", post_data);
using (var requestStream = request.GetRequestStream())
{
requestStream.Write(StrToByteArray(login_post_data), 0, StrToByteArray(login_post_data).Length);
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using (Stream stream = response.GetResponseStream())
{
StreamReader reader = new StreamReader(stream);
string temp = reader.ReadToEnd();
richTextBox1.Text = temp;
}
foreach (string c in response.Cookies)
{
listBox1.Items.Add(c);
}
The thing is "https://site.com/cgi-bin/login.pl?logout" is the same page after i logged in and i need to pass the cookie
It looks like you try to log in and log out at the same time with your request, sent to URL
https://site.com/cgi-bin/login.pl?logout
Remove the ?logout parameter and try again. Please update your question if it doesn't change anything.
Please explain further, what you're trying to achieve, so we can discuss if the code is correct.
Related
i try to make an HTTP POST to an Swagger UI api and wrote this rudimentary Code:
string baseip = "192.168.0.1";
string auth = "authcodre";
string name = "TestMan";
string ip = "1.1.1.1";
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
string URL = "https://" + baseip + ":4444/api/objects/network/host/";
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URL);
request.ContentType = "application/json";
request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes("token:" + auth));
request.PreAuthenticate = true;
request.Method = "POST";
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
string patchtxt = "{ \"name\": \"" + name + "\", \"_type\": \"network/host\", \"address\": \"" + ip + "\"}";
streamWriter.Write(patchtxt);
streamWriter.Flush();
streamWriter.Close();
Console.WriteLine("Patches");
}
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
using (Stream responseStream = response.GetResponseStream())
{
StreamReader reader = new StreamReader(responseStream, Encoding.UTF8); //Einlesen der HTTP-Antwort
string resppatch = reader.ReadToEnd();
Console.WriteLine(resppatch);
Console.ReadLine();
}
It throws me an System.IO.IOException" in mscorlib.dll at this line:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URL);
Can anyone explain why this happens and how to fix it?
Thank you :)
Im try to extract data from a website with webclient but i dont know the exact parameters for the Post and i receive allways empty data.
Website: Red Arrow is the action and on green its the data i want
To see the Post parameters i use Google Ghrome Developer Tools and in the tab "Network" i look for the Post Request Header.
Post Request - Header
My C# code its this:
OLD CODE - This not working with webclient
string URI = "https://www.citius.mj.pt/Portal/consultas/ConsultaVendaAnuncios.aspx";
using (WebClient wc = new WebClient())
{
wc.Headers.Add(HttpRequestHeader.Accept, "*/*");
wc.Headers.Add(HttpRequestHeader.AcceptLanguage, "pt-PT,pt;q=0.8,en-US;q=0.6,en;q=0.4,es;q=0.2");
wc.Headers.Add(HttpRequestHeader.CacheControl, "no-cache");
//wc.Headers.Add(HttpRequestHeader.Connection, "keep-alive");
//wc.Headers.Add(HttpRequestHeader.ContentLength, "18801");
wc.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded; charset=UTF-8");
wc.Headers.Add(HttpRequestHeader.Cookie, "_pk_id.70.0919=b6cdc4d1ee3456d0.1456252054.2.1456255268.1456255085.;" + "ASP.NET_SessionId=zlth2slu3o05ek511w5jb4rt");
wc.Headers.Add(HttpRequestHeader.Host, "www.citius.mj.pt");
wc.Headers.Add("Origin", "https://www.citius.mj.pt");
wc.Headers.Add(HttpRequestHeader.Referer, "https://www.citius.mj.pt/Portal/consultas/ConsultaVendaAnuncios.aspx");
wc.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36");
wc.Headers.Add("X-MicrosoftAjax", "Delta=true");
wc.Headers.Add("X-Requested-With", "XMLHttpRequest");
string parametro1 = "ctl00$ContentPlaceHolder1$ScriptManager1=ctl00$ContentPlaceHolder1$ScriptManager1|ctl00$ContentPlaceHolder1$btnSearch";
string parametro2 = "ctl00$ContentPlaceHolder1$rbtlTribunais=False";
string parametro3 = "ctl00$ContentPlaceHolder1$ddlTribunais=- Todos os Tribunais -";
string parametro4 = "ctl00$ContentPlaceHolder1$rblDias=todos";
string parametro5 = "__EVENTTARGET=";
string parametro6 = "__EVENTARGUMENT=";
string parametro7 = "__LASTFOCUS=";
string parametro8 = "__VIEWSTATE=/wEPDwULLTE2MDIzOTkyMDcPFg4eCFBhZ2VTaXplAgoeCFdyaXRlTG9naB4OU2VhcmNoQ3JpdGVyaWEyvwMAAQAAAP////8BAAAAAAAAAAwCAAAAS1RyaWJ1bmFpc05ldC5XZWJzaXRlLCBWZXJzaW9uPTIuNC4zLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAUBAAAAPVRyaWJ1bmFpc05ldC5XZWJzaXRlLkRBTC5TZXJ2aWNlcy5WZW5kYUFudW5jaW9zU2VhcmNoQ3JpdGVyaWEDAAAAC19pZFVuT3JnUmVmBV9kaWFzCV9leHRpbnRvcwMDA25TeXN0ZW0uTnVsbGFibGVgMVtbU3lzdGVtLkludDMyLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDd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"ctl00$ContentPlaceHolder1$btnSearch=Pesquisar";
string parametros = parametro1 + "&" + parametro2 + "&" + parametro3 + "&" + parametro4 + "&" + parametro5 + "&" + parametro6 + "&" + parametro7 + "&" + parametro8 + "&" + parametro9 + "&" + parametro10 + "&" + parametro11;
string HtmlResult = wc.UploadString(URI, parametros);
}
What im doing wrong?
WORKING CODE FROM SAKURA + MYCODE to jump the next page
string URI = "https://www.citius.mj.pt/Portal/consultas/ConsultaVendaAnuncios.aspx";
CookieContainer cc = new CookieContainer();
HttpWebRequest h = (HttpWebRequest)WebRequest.Create(URI);
h.CookieContainer = cc;
HttpWebResponse hr = (HttpWebResponse)h.GetResponse();
using (var s = hr.GetResponseStream())
{
using (var r = new StreamReader(s, Encoding.UTF8))
{
string html = r.ReadToEnd();
Match mVS = Regex.Match(html, "id=\"__VIEWSTATE\" value=\"(.*?)\"", RegexOptions.Singleline);
Match mEV = Regex.Match(html, "id=\"__EVENTVALIDATION\" value=\"(.*?)\"", RegexOptions.Singleline);
Dictionary<string, string> param = new Dictionary<string, string>();
param.Add("ctl00$ContentPlaceHolder1$ScriptManager1", "ctl00$ContentPlaceHolder1$ScriptManager1|ctl00$ContentPlaceHolder1$btnSearch");
//param.Add("ctl00$ContentPlaceHolder1$ScriptManager1", "ctl00$ContentPlaceHolder1$upResultados|ctl00$ContentPlaceHolder1$Pager1$btnNextPage");
param.Add("__EVENTTARGET", "");
param.Add("__EVENTARGUMENT", "");
param.Add("__LASTFOCUS", "");
param.Add("__VIEWSTATE", mVS.Groups[1].Value);
param.Add("__EVENTVALIDATION", mEV.Groups[1].Value);
param.Add("ctl00$ContentPlaceHolder1$rbtlTribunais", "False");
param.Add("ctl00$ContentPlaceHolder1$ddlTribunais", "- Todos os Tribunais -");
param.Add("ctl00$ContentPlaceHolder1$rblDias", "todos");
param.Add("__ASYNCPOST", "true");
param.Add("ctl00$ContentPlaceHolder1$btnSearch", "Pesquisar");
string post = "";
foreach (var i in param)
{
post += WebUtility.UrlEncode(i.Key) + "=" + WebUtility.UrlEncode(i.Value) + "&";
}
var data = Encoding.UTF8.GetBytes(post);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URI);
request.CookieContainer = cc;
request.Referer = URI;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
request.UserAgent = "Mozilla/5.0 (Windows NT 6.3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36";
request.Headers.Add("Origin", "https://www.citius.mj.pt");
request.Headers.Add("X-Requested-With", "XMLHttpRequest");
request.Headers.Add("X-MicrosoftAjax: Delta=true");
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
int x = 1;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Dictionary<string, string> param2 = new Dictionary<string, string>();
//param.Add("ctl00$ContentPlaceHolder1$ScriptManager1", "ctl00$ContentPlaceHolder1$ScriptManager1|ctl00$ContentPlaceHolder1$btnSearch");
param2.Add("ctl00$ContentPlaceHolder1$ScriptManager1", "ctl00$ContentPlaceHolder1$upResultados|ctl00$ContentPlaceHolder1$Pager1$btnNextPage");
param2.Add("__EVENTTARGET", "");
param2.Add("__EVENTARGUMENT", "");
param2.Add("__LASTFOCUS", "");
param2.Add("__VIEWSTATE", mVS.Groups[1].Value);
param2.Add("__EVENTVALIDATION", mEV.Groups[1].Value);
param2.Add("ctl00$ContentPlaceHolder1$rbtlTribunais", "False");
param2.Add("ctl00$ContentPlaceHolder1$ddlTribunais", "- Todos os Tribunais -");
param2.Add("ctl00$ContentPlaceHolder1$rblDias", "todos");
param2.Add("__ASYNCPOST", "true");
//param2.Add("ctl00$ContentPlaceHolder1$btnSearch", "Pesquisar");
string post2 = "";
foreach (var i in param2)
{
post2 += WebUtility.UrlEncode(i.Key) + "=" + WebUtility.UrlEncode(i.Value) + "&";
}
var data2 = Encoding.UTF8.GetBytes(post2);
HttpWebRequest request2 = (HttpWebRequest)WebRequest.Create(URI);
request2.CookieContainer = cc;
request2.Referer = URI;
request2.Method = "POST";
request2.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
request2.UserAgent = "Mozilla/5.0 (Windows NT 6.3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36";
request2.Headers.Add("Origin", "https://www.citius.mj.pt");
request2.Headers.Add("X-Requested-With", "XMLHttpRequest");
request2.Headers.Add("X-MicrosoftAjax: Delta=true");
request2.ContentLength = data2.Length;
using (var stream2 = request2.GetRequestStream())
{
stream2.Write(data2, 0, data2.Length);
}
HttpWebResponse response2 = (HttpWebResponse)request2.GetResponse();
var responseString2 = new StreamReader(response2.GetResponseStream()).ReadToEnd();
int y = 2;
}
}
The problem is you not encode the POST data when you send back to server. You can use WebUtility.UrlEncode to endode them.
Here is modify of your code:
Note: wrap second request functions in using like the first request I do for you:
string URI = "https://www.citius.mj.pt/Portal/consultas/ConsultaVendaAnuncios.aspx";
CookieContainer cc = new CookieContainer();
HttpWebRequest h = (HttpWebRequest)WebRequest.Create(URI);
h.CookieContainer = cc;
HttpWebResponse hr = (HttpWebResponse)h.GetResponse();
using (var s = hr.GetResponseStream())
{
using (var r = new StreamReader(s, Encoding.UTF8))
{
string html = r.ReadToEnd();
//Console.WriteLine(html);
Match mVS = Regex.Match(html, "id=\"__VIEWSTATE\" value=\"(.*?)\"", RegexOptions.Singleline);
//Console.WriteLine(mVS.Groups[1].Value);
Match mEV = Regex.Match(html, "id=\"__EVENTVALIDATION\" value=\"(.*?)\"", RegexOptions.Singleline);
Dictionary<string, string> param = new Dictionary<string, string>();
param.Add("ctl00$ContentPlaceHolder1$ScriptManager1", "ctl00$ContentPlaceHolder1$ScriptManager1|ctl00$ContentPlaceHolder1$btnSearch");
param.Add("__EVENTTARGET", "");
param.Add("__EVENTARGUMENT", "");
param.Add("__LASTFOCUS", "");
param.Add("__VIEWSTATE", mVS.Groups[1].Value);
param.Add("__EVENTVALIDATION", mEV.Groups[1].Value);
param.Add("ctl00$ContentPlaceHolder1$rbtlTribunais", "False");
param.Add("ctl00$ContentPlaceHolder1$ddlTribunais", "- Todos os Tribunais -");
param.Add("ctl00$ContentPlaceHolder1$rblDias", "todos");
param.Add("__ASYNCPOST", "true");
param.Add("ctl00$ContentPlaceHolder1$btnSearch", "Pesquisar");
string post = "";
foreach (var i in param) post += WebUtility.UrlEncode(i.Key) + "=" + WebUtility.UrlEncode(i.Value) + "&";
var data = Encoding.UTF8.GetBytes(post);
Console.WriteLine(data.Length);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URI);
request.CookieContainer = cc;
request.Referer = URI;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
request.UserAgent = "Mozilla/5.0 (Windows NT 6.3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36";
request.Headers.Add("Origin", "https://www.citius.mj.pt");
request.Headers.Add("X-Requested-With", "XMLHttpRequest");
request.Headers.Add("X-MicrosoftAjax: Delta=true");
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
Console.WriteLine(responseString);
}
}
I'm trying to log in at http://carkit.kg (django app) via C# with following code
HttpWebRequest tokenRequest = (HttpWebRequest)WebRequest.Create("http://carkit.kg");
tokenRequest.CookieContainer = new CookieContainer();
string token = "";
using (var response = (HttpWebResponse)tokenRequest.GetResponse()) {
token = response.Cookies["csrftoken"].ToString().Split('=')[1];
}
HttpWebRequest loginRequest = (HttpWebRequest)WebRequest.Create("http://carkit.kg");
var cache = new CredentialCache();
cache.Add(new Uri("http://carkit.kg"), "Basic", new NetworkCredential(username, password));
loginRequest.Credentials = cache;
loginRequest.PreAuthenticate = true;
loginRequest.Method = "POST";
loginRequest.CookieContainer = new CookieContainer();
loginRequest.CookieContainer.Add(new Cookie("csrftoken", token) {Domain="carkit.kg"});
Debug.Log(token);
byte[] data = Encoding.ASCII.GetBytes("username=" + username + "&password=" + password + "&csrfmiddlewaretoken=" + token);
loginRequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
loginRequest.Headers.Add("Accept-Encoding", "gzip, deflate");
loginRequest.Headers.Add("Cache-Control", "max-age=0");
loginRequest.Headers.Add("Accept-Language", "ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4");
//loginRequest.ContentType = "application/x-www-form-urlencoded";
loginRequest.Headers.Add("Origin", "http://carkit.kg");
loginRequest.Referer = "http://carkit.kg/";
loginRequest.Headers.Add("UpgradeInsecureRequests", "1");
loginRequest.Headers.Add("XCompress", "null");
loginRequest.Headers.Add("ContentType", "application/x-www-form-urlencoded");
loginRequest.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36";
loginRequest.Headers.Add("X-CSRFToken",token);
loginRequest.ContentLength = data.Length;
loginRequest.Timeout = 3000;
loginRequest.GetRequestStream().Write(data, 0, data.Length);
loginRequest.Headers.Add("X-CSRFToken", token);
HttpWebResponse authResponse = (HttpWebResponse)loginRequest.GetResponse();
Debug.Log(authResponse.ResponseUri);
Both requests running well, but last line returns incorrect uri (if login is correct it should redirect me to /game and stay at / in other case) - anyway it returns /. Redirect is enabled and you see which headers I've included into request. What is the problem?
I've just used django-rest-framework as authentication service and LogIn method got this representation:
public void LogIn(string username, string password)
{
var request = (HttpWebRequest)WebRequest.Create("http://carkit.kg/api/v1/auth/login/");
var postData = "username=" + username;
postData += "&password=" + password;
var data = Encoding.UTF8.GetBytes(postData);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
try {
var response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode == HttpStatusCode.OK) {
// Successful login
}
else {
serverMessenger.SendErrorMessage(0);
Debug.LogError("Cannot Find User. TryToLogin finished");
}
} catch (WebException e) {
serverMessenger.SendErrorMessage(0);
Debug.LogError("Cannot Find User. TryToLogin finished");
}
}
I am currently working on a class that helps me creating WebRequest with cookies and POST parameters. But the response.cookies is always empty. How can i grab the returned cookies and send them with the next request?
class WebHandler
{
private string lasturl = "";
private Dictionary<string, Cookie> cookies;
public string lastContent;
public WebHandler()
{
cookies = new Dictionary<string, Cookie>();
}
public HttpWebResponse request(string address)
{
lasturl = address;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);
foreach (KeyValuePair<string, Cookie> pair in this.cookies)
{
Console.WriteLine(" Sent cookie: " + pair.Value.Name + " = " + pair.Value.Value);
request.CookieContainer.Add(pair.Value);
}
request.Method = "GET";
if(lasturl != "")
request.Referer = lasturl;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
foreach (Cookie newCookie in response.Cookies)
{
Console.WriteLine(" new cookie: " + newCookie.Name + " = " + newCookie.Value);
this.cookies[newCookie.Name] = newCookie;
}
lastContent = new StreamReader(response.GetResponseStream()).ReadToEnd();
return response;
}
public HttpWebResponse request(string address, Dictionary<string, string> postParameters)
{
lasturl = address;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);
foreach (KeyValuePair<string, Cookie> pair in this.cookies)
{
Console.WriteLine(" Sent cookie: " + pair.Value.Name + " = " + pair.Value.Value);
request.CookieContainer.Add(pair.Value);
}
request.Method = "POST";
string postData = "";
foreach (string key in postParameters.Keys)
postData += HttpUtility.UrlEncode(key) + "=" + HttpUtility.UrlEncode(postParameters[key]) + "&";
byte[] data = Encoding.ASCII.GetBytes(postData);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(data, 0, data.Length);
requestStream.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
foreach (Cookie newCookie in response.Cookies)
{
Console.WriteLine(" new cookie: " + newCookie.Name + " = " + newCookie.Value);
this.cookies[newCookie.Name] = newCookie;
}
lastContent = new StreamReader(response.GetResponseStream()).ReadToEnd();
return response;
}
}
Since this.cookies is initially null, your code never enters the loop
foreach (KeyValuePair<string, Cookie> pair in this.cookies)
{
Console.WriteLine(" Sent cookie: " + pair.Value.Name + " = " + pair.Value.Value);
request.CookieContainer.Add(pair.Value);
}
Bad part of it that you never see request.CookieContainer is null (Otherwise you would get null reference exception) which would show you something is wrong.
Since request.CookieContainer is null, HttpWebResponse never gets the returned cookies.
Solution: Easy, Just add
if (request.CookieContainer == null)
request.CookieContainer = new CookieContainer();
after
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);
PS: You may want to read this question about Naming Conventions in c#.
PS2: in a method request using a variable name request doesn't improve readability.
I had the same problem, so I added request.AllowAutoRedirect=false;, now I can get cookies:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);
...
request.Method = "POST";
request.AllowAutoRedirect=false;
If the HttpWebResponse object's Cookies collection is empty, then that means the response had no new cookies. To get access to all cookies for request and response, then read the cookies from the HttpWebRequest object instead, like this:
foreach (Cookie newCookie in request.Cookies)
{
// Do something with cookies here for next request
}
My problem is that I get 0 bytes response from server (I'm using Fiddler2 to check this out).
Picture:
What I'm doing:
Log in. I get cookies.
Creating thread
public void CreateTopic(string subject, string message, string forumId)
{
HttpWebResponse response = null;
string source = string.Empty;
string lastClick= string.Empty;
string creationTime= string.Empty;
string formToken = string.Empty;
// GET
while(true)
{
webRequest =
(HttpWebRequest) HttpWebRequest.Create(Url + "posting.php?mode=post&f=" + forumId + "&sid=" + sid);
webRequest.KeepAlive = true;
webRequest.Method = "GET";
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.Host = Url.Replace("http://", "").Replace("/", "");
webRequest.CookieContainer = cookieJar;
ServicePointManager.Expect100Continue = false;
try
{
response = (HttpWebResponse) webRequest.GetResponse();
UpdateSid(Url + "posting.php?mode=post&f=" + forumId + "&sid=" + sid);
}
catch (Exception ex)
{
continue;
}
break;
}
StreamReader streamReader = new StreamReader(response.GetResponseStream());
source = streamReader.ReadToEnd();
streamReader.Close();
response.Close();
// Get stuff
// last click
Match lastClickMatch = Regex.Match(source, "name=\"lastclick\" value=\"([0-9]{10})\" />");
if (lastClickMatch.Success) lastClick = lastClickMatch.Groups[1].Value;
// creation time
Match creationTimeMatch = Regex.Match(source, "name=\"creation_time\" value=\"([0-9]{10})\" />");
if (creationTimeMatch.Success) creationTime = creationTimeMatch.Groups[1].Value;
// form token
Match formTokenMatch = Regex.Match(source, "name=\"form_token\" value=\"(.{40})\" />");
if (formTokenMatch.Success) formToken = formTokenMatch.Groups[1].Value;
// POST
webRequest = (HttpWebRequest)WebRequest.Create(Url + "posting.php?mode=post&f=" + forumId + "&sid=" + sid);
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.Host = Url.Replace("http://", "").Replace("/", "");
webRequest.CookieContainer = cookieJar;
string data = "icon=&subject=" + Encode(subject) + "&addbbcode20=100&message=" + Encode(message) + "&attach_sig=on&post=Submit&lastclick=" + lastClick + "&creation_time=" + creationTime + "&form_token=" + formToken;
byte[] byte1 = Encoding.UTF8.GetBytes(data);
webRequest.ContentLength = byte1.Length;
ServicePointManager.Expect100Continue = false;
Stream stream = webRequest.GetRequestStream();
stream.Write(byte1, 0, byte1.Length);
stream.Close();
response = (HttpWebResponse)webRequest.GetResponse();
UpdateSid(Url + "posting.php?mode=post&f=" + forumId + "&sid=" + sid);
response.Close();
}
I get this on fiddler:
RAW:
POST http://stuff.com/posting.php?mode=post&f=8&sid=6d278be1e705fe0261f253bbc96ab7a4
HTTP/1.1 Content-Type: application/x-www-form-urlencoded
Host: stuff.com
Cookie: phpbb3_goeyz_u=55443;phpbb3_goeyz_k=;phpbb3_goeyz_sid=6d278be1e705fe0261f253bbc96ab7a4
Content-Length: 165
icon=&subject=g&addbbcode20=100&message=d&attach_sig=on&post=Submit&lastclick=1323904393&creation_time=1323904393&form_token=b81c23e308f0bd3a0a73907efcc8c18e5dba0f7f
Response RAW:
HTTP/1.1 302 Found
Date: Wed, 14 Dec 2011 23:13:14 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: PHP/5.3.2-1ubuntu4.10
Location: http://stuff.com/games.html
Vary: Accept-Encoding
Content-Length: 0
Connection: close
Content-Type: text/html
I have no idea what is going on. If you will help me I will be grateful. I'm sorry for my English.
I found this snippet in the source of phpBB 3.0.9:
203 // Check permissions
204 if ($user->data['is_bot'])
205 {
206 redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
207 }
So they might be pulling you a trick here. Are you sure you are allowed to do what you're trying to?
Anyhow, I think you might to want to change your user agent:
webRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.36 Safari/535.7";
This might help not being identified as a bot, which perhaps takes place because the default UserAgent value is null.
I found out why it didn't create thread. It checks:
if ($user->data['is_bot'])
If you don't want to be a bot, then you have to WAIT for like 8 seconds before sending POST:
Thread.Sleep(8100);
It resolved all problems for me.
Its returning a status code of 302 Found, which means the server is attempting to redirect you to another page (in your example, "http://stuff.com/games.html").