Jump to content

  •  

  • iBotModz CBox


    Photo

    C# Loading reCaptcha into a imagebox


    • Please log in to reply
    26 replies to this topic

    #21 decrypT

    decrypT

      Recruit

    • Members+

    • 4 posts
    • Joined: 04-August 10

    Posted 09 August 2010 - 05:12 PM

    Posted Image

    • Click on your webBrowser (If its a hidden one select it from the dropdown)
    • Click the lightning bolt to bring up events
    • Double click on DocumentCompleted
    • That will move to your code and form the function
    Looks like this.

    Posted Image


    You cannot just type that out, you gotta do all the steps to insure the handler picks up the event.


    yeah i threw the getelements/names in that document completed method.

    webBrowser1.GetElementById("ID HERE").SetAttribute("value", fdsfs.Text);

    But i was wondering how i could reload the captcha after each entry. Using an if loop i guess.

    Edited by decrypT, 14 August 2010 - 01:01 AM.


    #22 ikizmert

    ikizmert

      Recruit

    • Members+

    • 3 posts
    • Joined: 28-November 12

    Posted 28 November 2012 - 04:38 PM

    My code is not is not working,

    private void btnKayit_Click(object sender, EventArgs e)
    	 {
    		 webBrowser1.Navigate("http://xpblogger.com/register.php");
    	 }
    
    foreach (HtmlElement images in webBrowser1.document.Images)
    {
    
    if (images.GetAttribute("src").Contains("http://api.recaptcha.net/noscript?k="))
    {
    string url = images.GetAttribute("src");
    pictureBox1.ImageLocation = url;
    break;
    }
    }

    if (images.GetAttribute("src").Contains("http://api.recaptcha...et/noscript?k=")) type is FALSE
    Please help me. Thank you..

    Edited by ikizmert, 28 November 2012 - 04:53 PM.


    #23 iBotPeaches

    iBotPeaches

      General Grade 6

    • Owner

    • 6,570 posts
    • Joined: 29-July 07
    • Gender:Male
    • Location:Kansas

    Posted 28 November 2012 - 05:02 PM

    My code is not is not working,

    private void btnKayit_Click(object sender, EventArgs e)
    	 {
    		 webBrowser1.Navigate("http://xpblogger.com/register.php");
    	 }
    
    foreach (HtmlElement images in webBrowser1.document.Images)
    {
    
    if (images.GetAttribute("src").Contains("http://api.recaptcha.net/noscript?k="))
    {
    string url = images.GetAttribute("src");
    pictureBox1.ImageLocation = url;
    break;
    }
    }

    if (images.GetAttribute("src").Contains("http://api.recaptcha...et/noscript?k=")) type is FALSE
    Please help me. Thank you..


    It seems the recaptcha code has changed.

    			    if (images.GetAttribute("OuterHtml").Contains("http://www.google.com/recaptcha/api/image?"))
    			    {
    				    string url = images.GetAttribute("OuterHtml");
    				    break;
    			    }
    

    That would work, but then you'll need to create some regex to pull the correct stuff out of that url var. It seems recaptcha is changing, but no offense this topic is like 3 years old.

    #24 ikizmert

    ikizmert

      Recruit

    • Members+

    • 3 posts
    • Joined: 28-November 12

    Posted 28 November 2012 - 05:07 PM

    It seems the recaptcha code has changed.

    			 if (images.GetAttribute("OuterHtml").Contains("http://www.google.com/recaptcha/api/image?"))
    			 {
    				 string url = images.GetAttribute("OuterHtml");
    				 break;
    			 }
    

    That would work, but then you'll need to create some regex to pull the correct stuff out of that url var. It seems recaptcha is changing, but no offense this topic is like 3 years old.

    (images.GetAttribute("OuterHtml").Contains("http://www.google.co...cha/api/image?") = FALSE ; its didnt work.

    but no offense this topic is like 3 years old. i not knowing im sorry... my english easy, i used google translate :))
    Thank you anyway...

    Edited by ikizmert, 28 November 2012 - 05:13 PM.


    #25 iBotPeaches

    iBotPeaches

      General Grade 6

    • Owner

    • 6,570 posts
    • Joined: 29-July 07
    • Gender:Male
    • Location:Kansas

    Posted 28 November 2012 - 06:38 PM

    (images.GetAttribute("OuterHtml").Contains("http://www.google.co...cha/api/image?") = FALSE ; its didnt work.

    but no offense this topic is like 3 years old. i not knowing im sorry... my english easy, i used google translate :))
    Thank you anyway...


    The code I gave you works. You just need to write regex to pull the URL out of the variable "url", as its actual the <a href="" dump of the image.

    #26 ikizmert

    ikizmert

      Recruit

    • Members+

    • 3 posts
    • Joined: 28-November 12

    Posted 29 November 2012 - 07:46 AM

    okay but i don't understand this working logic. How can i work :no ? Plesae help

    #27 iBotPeaches

    iBotPeaches

      General Grade 6

    • Owner

    • 6,570 posts
    • Joined: 29-July 07
    • Gender:Male
    • Location:Kansas

    Posted 29 November 2012 - 11:14 AM

    okay but i don't understand this working logic. How can i work :no ? Plesae help


    Did you even try the code I posted? It grabs the entire HTML block of the image including the < a href > and blah blah what not. So you just need to pull the URL out of that via regex. Google for that.