I am setting my app using web request but I need to call the captcha (which is a javascript). Any way to have the web request run the captcha javascript and download the challenge?
I am setting my app using web request but I need to call the captcha (which is a javascript). Any way to have the web request run the captcha javascript and download the challenge?
for the captcha, regex / xpath out the data you need
This is where I am stuck...the link for the captcha isn't in the source code of the request...the web browser control runs the Javascript and returns the captcha image url after it is ran.
In a simple httpwebrequest you are only going to get the raw source code. The captcha exist but in it's pre-ran state which doens't do me any good because if you run the captcha from the public key you will get an image however it is ran from the Google site and not the website you are trying to create an account for.
The only way that I know to work it to run the Javascript somehow that would give me the url of the actual image (like the web browser) and pop that into a picturebox.
If you know of another way to do this...please do tell.
Thanks for your support Rage9.
What would you use as an equivalent to the Live Headers for use with purely http web request?
This is where I am stuck...the link for the captcha isn't in the source code of the request...the web browser control runs the Javascript and returns the captcha image url after it is ran.
<script type="text/javascript" src="http://api.recaptcha.net/challenge?k=6LfwKQQAAAAAAPFCNozXDIaf8GobTb7LCKQw54EA"></script>
I do see the challenge code....do I just regex that out and pop it into a picturebox?
When I try to pop it in to a picturebox just using the Challenge code I get an error of "parameter not found"
I'm just using a simple url to load into a picturebox. This works if I try is with any other "internet picture" but not this particular one.
WebReqPic.Load(TextBox1.Text)
![]()
This is the error I get when I try to load the image code you gave me above
![]()
I do see the challenge code....do I just regex that out and pop it into a picturebox?
var RecaptchaState = {
site : '6LfwKQQAAAAAAPFCNozXDIaf8GobTb7LCKQw54EA',
rtl : false,
challenge : '03AHJ_VusYeOKuO-S3rJbgfvTXgu1CzlXgs8Qb8H_NwEjuyu2nFuuSkcWR-3CTpSHuFa48r2x7wJcY10Cdpp5F6-IPztQfjzDEYC7h5iPKh5W5H8dS4WbJ0NsUbl_LII_y1zOEDyJKKNSnDnLdoCfpA9EUIO9tckI3Lg',
is_incorrect : false,
programming_error : '',
error_message : '',
server : 'http://www.google.com/recaptcha/api/',
lang : 'fil',
timeout : 1800
};
document.write('<scr'+'ipt type="text/javascript" s'+'rc="' + RecaptchaState.server + 'js/recaptcha.js"></scr'+'ipt>');
WebReqPic is the Picturebox.
Yeah I'm trying to load the scr file into a picturebox so the user can solve the captcha and send it back to the website to create a new account for a social bookmarker.
Picturebox.Load("")
This was a slice of code that I found where you can load an img into the picture box via URL.
The only thing that I am having issues with is that the challenge code isn't an image but a src so I'm not to sure on how to load this up into the picturebox.
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Button1_Click([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Button1.Click
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] postData [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]""
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] tempCookies [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] CookieContainer
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] encoding [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] UTF8Encoding
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] byteData [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Byte[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]() = encoding.GetBytes(postData)
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] postReq [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] HttpWebRequest = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]DirectCast[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](WebRequest.Create(TextBox1.Text), HttpWebRequest)
postReq.Method = [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"POST"
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]postReq.KeepAlive = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]postReq.CookieContainer = tempCookies
postReq.ContentType = [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"application/x-www-form-urlencoded"
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]postReq.Referer = TextBox1.Text
postReq.UserAgent = [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]postReq.ContentLength = byteData.Length
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] postreqstream [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Stream = postReq.GetRequestStream()
postreqstream.Write(byteData, 0, byteData.Length)
postreqstream.Close()
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] postresponse [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] HttpWebResponse
postresponse = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]DirectCast[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](postReq.GetResponse(), HttpWebResponse)
tempCookies.Add(postresponse.Cookies)
logincookie = tempCookies
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] postreqreader [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] StreamReader(postresponse.GetResponseStream())
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] thepage [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = postreqreader.ReadToEnd
RichTextBox1.Text = thepage
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE][/COLOR][/SIZE]
var RecaptchaState = {
site : '6Lc4KcMSAAAAAIrokS2JikdI-x4ApVbh1xV2v_K1',
rtl : false,
challenge : '03AHJ_VuscqFJSuB8OQk_xWVpV0bfYX2z4mBpjrog95W2wbPq0QbQ5P9ziMqDkMERaBc80kx-i6WmKV8sZO0wRcGlWW1VlynbrXOwfSHyPh_POPsLkVIWGMEdL2uxheHrF5F5XKyuYe2-L9-3lbDJ0j91IbzAfsrP3sg',
is_incorrect : false,
programming_error : '',
error_message : '',
server : 'http://www.google.com/recaptcha/api/',
lang : 'en-US',
timeout : 1800
};
document.write('<scr'+'ipt type="text/javascript" s'+'rc="' + RecaptchaState.server + 'js/recaptcha.js"></scr'+'ipt>');