R
R
rusgayfer2017-08-16 05:18:04
In contact with
rusgayfer, 2017-08-16 05:18:04

How to create a captcha form from VK?

The fact is that after many requests in VK, a captcha pops up. I have this captcha in the form action="/api" but in this form there is also a captcha form:

if(isset($request['error']['captcha_img'])) 
    {
    echo  "<div class=\"callout callout-danger\"> Нужно ввести капчу<br>
    <img src=".$request['error']['captcha_img']." alt=\"Captcha\">
    <form method = \"post\">
    <input type=\"text\" name=\"captcha_key\" required>                                  
    <input type=\"hidden\" name=\"captcha_sid\" value=".$request['error']['captcha_sid'].">
    <button type=\"submit\" class=\"btn btn-primary\">Отправить</button>
    </form>
    </div>";
    }

When I click submit, the captcha is not sent. When I click Send, I get a redirect to action="/api" (this is a form for sending messages) and then it returns the captcha to me again, how can I make sure that if a captcha appears, it is sent?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Serezha, 2017-08-16
@rusgayfer

I didn't look at the code, it's some kind of horror.
How to do it - if an error occurs, you need to repeat the request with the same parameters, but with the addition of captcha parameters. A separate form for captcha is not needed, if an error occurs, it is enough to leave the fields of the usual form filled in as they were filled before sending and add the captcha input field to them, and the captcha itself.
Send a request EXACTLY SAME as all other requests are sent, the only difference is the added captcha parameter.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question