I've been trying to do the following:
Make web scraping to a page that has captcha.
Put its picture with the code captha on my website to be entered by the user making the request.
But I have encountered the following, the product generates the following touch:
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJMTY3ODU1NDM3D2QWAgIBD2QWAgIBD2QWAgIED2QWAgIBD2QWAgIBD2QWAgIDDw8WBh4JRm9yZUNvbG9yDB4EVGV4dAU0SW50cm9kdXpjYSBsb3MgbsO6bWVyb3MgcXVlIHNlIG11ZXN0cmFuIGVuIGxhIGltYWdlbh4EXyFTQgIEZGRkI2vSAHfBwff4bQeYBeNrp2LgasjW5sAD/qaJaVX0FpI=">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="CA0B0334">
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEdAAUwHk+inUhBKZDyswsk5NNZgR+Ryzr40mCfb2xFWNvaXeZZujVI1Q63igKvL1NytQuECrD8jc5xpRI7GCI9w78rcjH6FuL/XcvxzPKyRvH3SBFX/SsuYstDGgj/PHztePFe/30iEMMQ1c1DxkjUszAx">
I take hours trying to do this but I'm seeing impossible. To provide the data I'm doing the following:
string strURL;
string strPostData = "";
string strResult;
HttpWebResponse webrespond;
HttpWebRequest webresquest;
StreamReader sr;
StreamWriter sw;
//set url to post
strURL = "http://ift.tt/1NiFHJH";
//post some data
strPostData = "txtCodigo=001123458&CaptchaImage1$CodeNumberTextBox=9563";
webresquest = (HttpWebRequest)WebRequest.Create(strURL);
webresquest.Method = "POST";
webresquest.Referer = strURL;
webresquest.ContentType = "application/x-www-form-urlencoded";
webresquest.ContentLength = strPostData.Length;
//post data
sw = new StreamWriter(webresquest.GetRequestStream());
sw.Write(strPostData);
sw.Close();
//read the returned data
webrespond = (HttpWebResponse)webresquest.GetResponse();
sr = new StreamReader(webrespond.GetResponseStream());
strResult = sr.ReadToEnd();
sr.Close();
return strResult
;
thanks :)
Aucun commentaire:
Enregistrer un commentaire