Curl simulates user login, but with verification code

Source: Internet
Author: User
I am using curl to do a user simulation login, but encountered a verification code. I found a lot of information on the Internet, but I didn't solve the problem. I think the idea of trying to simulate a login is something like this:

1, get the form on the page, simulate fill in the login name and password;
2, from the verification code picture to obtain the verification Code, simulation fill in the Verification code; (This step to obtain the verification code can not solve)
3. Submit cookies and parameters to log in and save local cookies;

Where the 2nd step encountered a problem, how will the verification code? Do you use the image recognition library? Or download let the user manually input it? Or is there another way?

Hope to do this kind of needs of friends to help, thank you ~

Reply content:

I am using curl to do a user simulation login, but encountered a verification code. I found a lot of information on the Internet, but I didn't solve the problem. I think the idea of trying to simulate a login is something like this:

1, get the form on the page, simulate fill in the login name and password;
2, from the verification code picture to obtain the verification Code, simulation fill in the Verification code; (This step to obtain the verification code can not solve)
3. Submit cookies and parameters to log in and save local cookies;

Where the 2nd step encountered a problem, how will the verification code? Do you use the image recognition library? Or download let the user manually input it? Or is there another way?

Hope to do this kind of needs of friends to help, thank you ~

Speedy answer

    1. Manual input
    2. Spend money on online coding of API online
    3. OCR (inaccurate, simple captcha can be, but generally not expected)

You can go to www.uuwise.com such a website, to understand the verification code coding Black Technology

    • If you manually code, with PHP with a cookie to verify the value of the code, and then set Header("Content-Type: image/jpeg"); spit, here you can combine the front-end to make small improvements, such as the Ajax Long poll or WebSocket to do a real-time reminder of the little thing, once the new verification code is generated, Your client ding-dong prompts you to hit the verification code, finishes, passes the content to the Curl class, and curl simulates you passing the verification code to the website. In PHP There is a very powerful simulation library, called snoopy.class.php .
    • If the verification code is relatively simple (no distortion, no interference line, non-Chinese, character length is fixed length, each code character boundary distance is equal, noise is small, the font is not uncommon or you can find), that is, you think the machine can be identified according to a certain pattern, then you write an OCR with PHP, or call the extension, I don't know if there are any OCR extensions you can look for yourself. Write their own simple, I remember is the picture two, and then the area of each letter split, calculate the proportion of black, and has a font library comparison, online similar tutorial too much, their own practice.

http://blog.csdn.net/ugg/article/details/3972368
Http://jingyan.baidu.com/article/456c463b66e5320a583144b7.html
Http://www.poboke.com/study/php-verification-code-identification-primary.html

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.