c# - HTTP POST with Facebook Captcha -


i'm trying facebook captcha image in c# , display in app , send response facebook. app works fine communicates facebook after while asks captcha. incorporated functionality entering captcha , when send facebook using webclient sens captcha in response. have double checked temperdata inn firefox i'm setting correct header information , fields, still i'm not being redirected right page. matter of fact in response header 1 field see missing compare temperdata.

    req = (httpwebrequest)webrequest.create("https://www.facebook.com/recover/initiate");         req.host = "www.facebook.com";         req.cookiecontainer = cookies;         req.method = "get";         req.useragent = "mozilla/5.0 (windows nt 6.2; wow64; rv:22.0) gecko/20100101 firefenter code hereox/22.0";     req.keepalive = true;     resp = req.getresponse();     streamreader = new streamreader(resp.getresponsestream());     s = streamreader.readtoend().trim();      index = s.indexof("https://www.facebook.com/captcha/tfbimage.php?");     if (index == -1)         continue;     string uri = s.substring(index);     uri = uri.substring(0, uri.indexof("\\\"") - 1);      string captcha_persist_data = s.substring(s.indexof("captcha_persist_data"));                         captcha_persist_data = captcha_persist_data.substring(captcha_persist_data.indexof("value") + 7);     captcha_persist_data = captcha_persist_data.substring(0, 1156);      string lsd = s.substring(s.indexof("lsd"));     lsd = lsd.substring(lsd.indexof("value") + 7);     lsd = lsd.substring(0, 8);     client = new webclient();     coo += "act=1375466977443%2f3;_e_0p4m_2=%5b%220p4m%22%2c1375466960620%2c%22act%22%2c1375466960619%2c2%2c%22captcha_response%22%2c%22click%22%2c%22click%22%2c%22-%22%2c%22r%22%2c%22%2frecover%2finitiate%22%2c%7b%22ft%22%3a%7b%7d%2c%22gt%22%3a%7b%7d%7d%2c0%2c0%2c0%2c1423%2c16%5d;wd=1920x796;_e_0p4m_3=%5b%220p4m%22%2c1375466977445%2c%22act%22%2c1375466977443%2c3%2c%22captcha_submit%22%2c%22click%22%2c%22click%22%2c%22-%22%2c%22r%22%2c%22%2frecover%2finitiate%22%2c%7b%22ft%22%3a%7b%7d%2c%22gt%22%3a%7b%7d%7d%2c0%2c0%2c0%2c1423%2c16%5d";      client.headers[httprequestheader.host] = "www.facebook.com";     client.headers[httprequestheader.useragent] = "mozilla/5.0 (windows nt 6.2; wow64; rv:22.0) gecko/20100101 firefox/22.0";     client.headers[httprequestheader.accept] = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";     client.headers[httprequestheader.acceptlanguage] = "en-us,en;q=0.5";     //client.headers[httprequestheader.acceptencoding] = "gzip, deflate";     client.headers[httprequestheader.referer]="https://www.facebook.com/recover/initiate";     client.headers[httprequestheader.cookie] = coo;     //client.headers[httprequestheader.connection] = "keep-alive";     client.headers[httprequestheader.contenttype] = "application/x-www-form-urlencoded";     //client.headers[httprequestheader.contentlength] = "1235";    image1.source = new bitmapimage(new uri(uri));     messagebox.show("alert");     streamreader = new streamreader("d:\\abc.txt");     string newstr = streamreader.readline();     streamreader.close();      namevaluepairs = new namevaluecollection();     namevaluepairs.add("lsd", lsd);      namevaluepairs.add("captcha_persist_data", captcha_persist_data);      namevaluepairs.add("captcha_response", newstr);      namevaluepairs.add("captcha_submit", "submit");      response = client.uploadvalues("https://www.facebook.com/recover/initiate", namevaluepairs);     chars = new char[response.length];     (int = 0; < response.length; i++)     {         chars[i] = convert.tochar(response[i]);     }     s = new string(chars); 

any appreciated.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -