Ich habe da eine Problem ich habe schon alles mögliche versucht aber ich bekomme einfach immer den gleichen fehler
hier der Code
Code:
public string gettokdeMail()
{
try
{
CookieContainer cookieContainer = new CookieContainer();
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("https://www.ok.de/reg/");
httpWebRequest.CookieContainer = cookieContainer;
httpWebRequest.Method = "GET";
httpWebRequest.Host = "www.ok.de";
httpWebRequest.KeepAlive = true;
httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:23.0) Gecko/20130419 Firefox/23.0";
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream());
Random rnd = new Random();
string patrick = GetBetween(1, streamReader.ReadToEnd(), "<input type=\"hidden\" name=\"patrick\" value=\"", "\" />", CompareMethod.Binary);
string PW = GetPW(rnd.Next(6, 15));
string User = GetName(rnd.Next(0, 9));
httpWebRequest = (HttpWebRequest)WebRequest.Create("https://www.ok.de/welcome/");
httpWebRequest.Method = "POST";
httpWebRequest.Host = "www.ok.de";
httpWebRequest.Referer = "https://www.ok.de/reg/";
httpWebRequest.KeepAlive = true;
httpWebRequest.CookieContainer = cookieContainer;
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:23.0) Gecko/20130419 Firefox/23.0";
byte[] bytes = Encoding.UTF8.GetBytes(string.Concat(new string[]
{
"reg_code=&u=&t=&e=&patrick=" ,
patrick ,
"®_mail=" ,
User,
"®_title=male®_firstname=" + GetRndName(rnd.Next(10,15)) + "®_lastname=" + GetRndName(rnd.Next(10,15)) + "®BirthdayDay=8®BirthdayMonth=11®BirthdayYear=1982®_address=" + GetRndName(rnd.Next(10,15)) + "+23®_postalcode=456765®_city=" + GetRndName(rnd.Next(10,15)) + "®_country=DEU®_altmail=" + GetRndName(rnd.Next(10,15)) + "%40web.de®_phone=02151+" + rnd.Next(10000000,99999999) + "®_mobile=®_password=",
PW
})
);
httpWebRequest.ContentLength = (long)bytes.Length;
Stream stream = httpWebRequest.GetRequestStream();
stream.Write(bytes, 0, bytes.Length);
stream.Close();
httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
stream = httpWebResponse.GetResponseStream();
streamReader = new StreamReader(stream);
string text = streamReader.ReadToEnd();
return text + "\r\n" + "\r\n" + "\r\n" + "\r\n" + User + "@ok.de:" + PW;
}
catch
{
return "Fehlgeschlagen!";
}
}
Wenn ich diesen Code ausführe bekomme ich immer eine fehler der in der HTML steht diesen hier
Code:
Sehr geehrter Gast, <br />
<br />
Bei Deiner Registrierung könnte ein Fehler aufgetreten sein.<br />
Bitte versuch Dich mit Deinem gewählten Benutzernamen und Passwort anzumelden. <br />
Sollte Dir dies nicht möglich sein, so wende Dich bitte an den ok.de Support.
und der account wurde auch nicht erfolgrech erstellt

Ich habe es auch schon mit
KeepAlive
versucht aber das bringt auch nichts immer der gleiche fehler hoffe da kann mir jemand weiter helfen
wenn ich es per Webbrowser eingebe erstellt er den Account auch.
Danke schon mal
Edit:
Das sagt man Live Http Headers wenn ich auf regestriren drücke
Code:
https://www.ok.de/welcome/
POST /welcome/ HTTP/1.1
Host: www.ok.de
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:23.0) Gecko/20130419 Firefox/23.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://www.ok.de/reg/
Cookie: __utma=86479878.819139583.1366029989.1366377688.1366390685.3; __utmz=86479878.1366029989.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmb=86479878.37.10.1366390685; __utmc=86479878; PHPSESSID=qv6cdjab817b8dj9hlfd0skg20; okrcc=50990cf38cb89; okrr=https%3A%2F%2Fwww.ok.de%2Flostpassword
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 1170
reg_code=&u=&t=&e=&patrick=%2FPNJE73fjpkLOZM%2Fcw81ZnolqToJ7sqA04VAOn7MQI%2B2GWQe8dJTSsYeSLQ9ZujLzHsUAagtHKHDTf3SAKobgEdwwX6hKQQBQJLEQbM4RxEcMfXHg9OR9UhruG%2B5ZJl2p6LxKwSfSJ27BW4iL53eQq1pOi57dQExPn%2FXGaXyItfygQUok9JEe8NN%2FdIAqhuAR3DBfqEpBAE9YjDA0VwnNAF5JNagTOG6gzYZqnENvFA20f7GXP7DvPgYnf1mQgAZfr29kc8%2FqKjMNyd%2BSMD%2BqnZRGCTwZjJIZH5Lhl1q70ctIrHTDoOifQMQLFFWeGmbZzOjYpbQmWiiJo%2BxhVEoQ16r3LEiUcuZU6AOl8jfK1T4gDwONoN0wzroED85Fj9lKflER9wQ9JNotIy5nX4msqNDPdDpbqDhivexDWHidQTMNyd%2BSMD%2BqpX%2FVQBVEyL%2FVCiaRLuuJJSiIKVqkOLyd1ODsbZ5Qt1yjRc5TtItDp1YiqroxJzqLOXbug%2Fbt62GU6AOl8jfK1Sk%2Fsuw2ddFVDroED85Fj9lOGtpH24YkNxYY2PTeQ2y6qprxbYzUVFw7xzRDAENoPKtaToue3UBMT5%2F1xml8iLXA1qbfZSK2sv9CHYHHHF3jajIprnqDD%2B2mG3GYDCa8CFpm1wISMQE6Z4WkWOpge%2FSyUqo%2FhFtOC44Gd4YtUDsCZhtxmAwmvAhaZtcCEjEBOlwn8GNY3iYSqprxbYzUVFwJletSMuFpM8eRxvWlUgWEphcHFdArdyIuLAQbLv4jfJWUD59YaSNCg%3D%3D®_mail=ertzjhmnvf®_title=male®_firstname=drtzujhmnvb®_lastname=drtzjghvn®BirthdayDay=8®BirthdayMonth=7®BirthdayYear=1988®_address=drthjnfgcgfht+4®_postalcode=5678765®_city=rtzujhg®_country=DEU®_altmail=rtzujgh%40e.fe®_phone=076543®_mobile=®_password=rthfgdtg
HTTP/1.1 200 OK
Server: nginx/1.2.3
Date: Fri, 19 Apr 2013 18:06:44 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.3.3-7+squeeze14
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: okrr=deleted; expires=Thu, 19-Apr-2012 18:06:43 GMT; path=/
Set-Cookie: okrrr=deleted; expires=Thu, 19-Apr-2012 18:06:43 GMT; path=/
Set-Cookie: okregc=deleted; expires=Thu, 19-Apr-2012 18:06:43 GMT; path=/
Content-Encoding: gzip