+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: captcha web API

  1. #1
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    captcha web API

    I know how everyone here loves APIs ,
    but I came across a web based API, that could
    be very useful in certain situations.

    A captcha - (login, designed to prevent automated spam
    by offering a human readable image pattern which needs to
    be keyed in for access).

    This captcha API is made available with only a few lines of code.
    I tried it, and it worked exactly as expected.

    Here is the sample script:
    Code:
    <?
    session_start();
    // You need a unique string that identifies the user. The easiest way is to
    // simply use the session ID. But because sending session IDs to other servers
    // can be a security problem, we use only a part of the session ID here.
    // This is still a quasi-unique string, so it works just as well.
    $captcha_id = substr(session_id(), 0, 15); // first 15 characters of the session ID
    ?>
    
    <html><head></head><body>
    <img src="http://captchator.com/captcha/image/<?= $captcha_id ?>" />
    <br />
    Please enter the text from the picture:
    <form action="test.php" method="post">
    <input type="text" name="captcha_answer" />
    <input type="submit" name="submit" value="Check" />
    </form>
    
    <?
    if ($_POST['captcha_answer']) {
      // remove anything except letters and numbers (security)
      $answer = preg_replace('/[^a-z0-9]+/i', '', $_POST['captcha_answer']);
      // check answer
      // if you get an error message because your provider has diabled allow_url_fopen,
      // please use the myfile() function from the following website instead of file():
      // http://www.klamm.de/crashforum/showpost.php?p=1041750&postcount=5
      if (implode(file("http://captchator.com/captcha/check_answer/".$captcha_id."/".$answer)) == '1') {
        echo '<div style="color: green">Answer correct!</div>';
      } else {
        echo '<div style="color: red">Wrong answer, please try again.</div>';
      }
    }
    ?>
    
    <p>
    See the <a href="test.php.txt">source code</a> of this script.
    </p>
    
    </body></html>
    Here is the sample script loaded:






    This is after I entered the proper code:






    This is after I entered an improper code:





    No difficult code here, just a simple API which is easily incorporated.

    Not for everyone, but in the right situation, it could be very helpful
    in the never ending fight against spam prevention.


    References:
    Captchator - Captcha service for PHP, Ruby on Rails, Python, ...

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Jordan Guest

    Re: captcha web API

    Very cool and good to know! +rep

  4. #3
    Join Date
    Jul 2006
    Posts
    16,486
    Blog Entries
    75
    Rep Power
    143

    Re: captcha web API

    Is that a free resource, or paid? As APIs go, it's pretty slick. +rep
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  5. #4
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    Re: captcha web API

    Yes 100% free

    Thanks for the +rep

    I think everyone hates spam!!
    (the online version) the ham product is OK

  6. #5
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20

    Re: captcha web API

    Does it offer any more advanced features? I've been using and recommending reCaptcha for a while, as it offers things like refresh to generate a new image and audio too, but I'm always open to new API's.

  7. #6
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    Re: captcha web API

    Quote Originally Posted by John View Post
    Does it offer any more advanced features? I've been using and recommending reCaptcha for a while, as it offers things like refresh to generate a new image and audio too, but I'm always open to new API's.
    No it doesn't offer advanced features,
    so if one is willing to sign-up your recommendation
    is much more feature rich.

  8. #7
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20

    Re: captcha web API

    Yeah, it offers some nice features.

  9. #8
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

  10. #9
    Hajjel's Avatar
    Hajjel is offline Newbie
    Join Date
    Oct 2009
    Posts
    22
    Rep Power
    0

    Re: captcha web API

    Very useful, tnx!

  11. #10
    kailas is offline Newbie
    Join Date
    Feb 2010
    Posts
    16
    Rep Power
    0

    Re: captcha web API

    Many thanks!

+ Reply to Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. 3D captcha - new captcha technology concept
    By Juraj Rolko in forum Technology Ramble
    Replies: 5
    Last Post: 07-25-2011, 03:44 PM
  2. [Help] PHP CAPTCHA CODE [Help]
    By xxcorrosionxx in forum PHP Development
    Replies: 3
    Last Post: 05-10-2011, 10:08 PM
  3. Captcha for php
    By exodia in forum PHP Development
    Replies: 3
    Last Post: 03-04-2011, 08:09 AM
  4. [.NET] Captcha Control
    By Charny in forum Classes and Code Snippets
    Replies: 3
    Last Post: 08-12-2010, 10:08 AM
  5. CAPTCHA Reader Help
    By BlaineSch in forum Java Help
    Replies: 6
    Last Post: 06-01-2010, 11:12 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts