SolveMedia audio via HTTP request

who@mi

Новичок
Joined
Oct 14, 2018
Messages
10
Reaction score
2
Points
3
Hi,

can someone explain how to make a http request to send Solvemedia audio captchas to capmonster? I checked all avalaible captcha services and couldn't find a API which supports audio captchas...

Thanks
 

who@mi

Новичок
Joined
Oct 14, 2018
Messages
10
Reaction score
2
Points
3
Ok, i've figured it out by myself now, if anybody need help with this just ask or send pm
 

VladZen

Administrator
Staff member
Joined
Nov 5, 2014
Messages
22,741
Reaction score
5,999
Points
113
Audio captcha should be sent as multipart in http request.
 

toan

Пользователь
Joined
Sep 15, 2018
Messages
48
Reaction score
0
Points
6
Ok, i've figured it out by myself now, if anybody need help with this just ask or send pm
how to do it? could you share with me
 

who@mi

Новичок
Joined
Oct 14, 2018
Messages
10
Reaction score
2
Points
3
Sure,
i use the 2captcha API for all my captchas, so i explain it on this API. The HTTP POST request for SolveMedia Audio is nearly like the one from normal TextCaptcha:

[YOURCAPMONSTER_IP_AND_PORT]in.php?key=[ANY_KEY_YOU_USE]&method=base64&body=[BASE64_ENCRYPTED_MP3_BYTES]&CapMonsterModule=ZennoLab.AudioSolveMedia
=> RESPONDS: OK|[ID] or ERROR
=> with ID make HTTP GET REQUEST to [YOURCAPMONSTER_IP_AND_PORT]res.php?key=[ANY_KEY_YOU_USE]&action=get&id=[ID]
=> RESPONDS: OK|[CAPTCHA_SOLUTION]

- Of course you can make this request to the original url 2.captcha.com instead of the CM ip:port, i just prefer the call over ip-address
- Maybe its possible to make it with multipart in HTTP request, for me it only works with base64 mp3-data, because multipart throws error 'empty audio' or like that, so i recommend base64 method

So, i hope this helps you to get it work.If you need more help just tell me, i will do my best. I can give example in C# and PHP/HTML, too.
 

toan

Пользователь
Joined
Sep 15, 2018
Messages
48
Reaction score
0
Points
6
Sure,
i use the 2captcha API for all my captchas, so i explain it on this API. The HTTP POST request for SolveMedia Audio is nearly like the one from normal TextCaptcha:

[YOURCAPMONSTER_IP_AND_PORT]in.php?key=[ANY_KEY_YOU_USE]&method=base64&body=[BASE64_ENCRYPTED_MP3_BYTES]&CapMonsterModule=ZennoLab.AudioSolveMedia
=> RESPONDS: OK|[ID] or ERROR
=> with ID make HTTP GET REQUEST to [YOURCAPMONSTER_IP_AND_PORT]res.php?key=[ANY_KEY_YOU_USE]&action=get&id=[ID]
=> RESPONDS: OK|[CAPTCHA_SOLUTION]

- Of course you can make this request to the original url 2.captcha.com instead of the CM ip:port, i just prefer the call over ip-address
- Maybe its possible to make it with multipart in HTTP request, for me it only works with base64 mp3-data, because multipart throws error 'empty audio' or like that, so i recommend base64 method

So, i hope this helps you to get it work.If you need more help just tell me, i will do my best. I can give example in C# and PHP/HTML, too.
i try it before too. but it return empty audio. it is great if you can give me C# sample.
thank a lot and have a nice weekend
 

who@mi

Новичок
Joined
Oct 14, 2018
Messages
10
Reaction score
2
Points
3
Hello, sorry was very busy last weekend. I think the error "empty audio" is because the AudioSolveMediaModule expects BASE64 encrypted Data, but not sure about that. Here is C# example how you can base64 encrypt the Data in a way the PHP Script on the CM Site can decrypt it. With this method i have no problems to solve but the code example is really Quick 'n'Dirty, so modify it that it fits you needs ;-)

Code:
        private void SendSolvemediaAudio(string FileNameOfMp3)
        {
            try
            {
                string base64 = Convert.ToBase64String(File.ReadAllBytes(FileNameOfMp3));
                 //Encode the '+' char, which C# Adds, so Data can be decrypted by PHP
                base64 = base64.Replace("+", "%2B");

                ServicePointManager.Expect100Continue = false;
                var request = (HttpWebRequest)WebRequest.Create("http://[CAPMONSTER_IP_PORT]/in.php");


                var postData = "key=[YOURKEY]&CapMonsterModule=ZennoLab.AudioSolveMedia&method=base64&body=" + base64;
                var data = Encoding.ASCII.GetBytes(postData);

                request.Method = "POST";

                request.ContentType = "application/x-www-form-urlencoded";
                request.ContentLength = data.Length;

                using (var stream = request.GetRequestStream())
                {
                    stream.Write(data, 0, data.Length);
                }

                var response = (HttpWebResponse)request.GetResponse();

                var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();

                //  GET
                if (responseString.Contains("OK|"))
                {
                    string id = responseString.Substring(3);

                   //Get the Result with id...
                
                }
                else
                {
                   //ErrorHandling
                }
            }
            catch (Exception ex)
            {
                //ErrorHandling

            }
        }

I hope i could help you little bit with this. Have a nice day
 
  • Thank you
Reactions: toan

toan

Пользователь
Joined
Sep 15, 2018
Messages
48
Reaction score
0
Points
6
Hello, sorry was very busy last weekend. I think the error "empty audio" is because the AudioSolveMediaModule expects BASE64 encrypted Data, but not sure about that. Here is C# example how you can base64 encrypt the Data in a way the PHP Script on the CM Site can decrypt it. With this method i have no problems to solve but the code example is really Quick 'n'Dirty, so modify it that it fits you needs ;-)

Code:
        private void SendSolvemediaAudio(string FileNameOfMp3)
        {
            try
            {
                string base64 = Convert.ToBase64String(File.ReadAllBytes(FileNameOfMp3));
                 //Encode the '+' char, which C# Adds, so Data can be decrypted by PHP
                base64 = base64.Replace("+", "%2B");

                ServicePointManager.Expect100Continue = false;
                var request = (HttpWebRequest)WebRequest.Create("http://[CAPMONSTER_IP_PORT]/in.php");


                var postData = "key=[YOURKEY]&CapMonsterModule=ZennoLab.AudioSolveMedia&method=base64&body=" + base64;
                var data = Encoding.ASCII.GetBytes(postData);

                request.Method = "POST";

                request.ContentType = "application/x-www-form-urlencoded";
                request.ContentLength = data.Length;

                using (var stream = request.GetRequestStream())
                {
                    stream.Write(data, 0, data.Length);
                }

                var response = (HttpWebResponse)request.GetResponse();

                var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();

                //  GET
                if (responseString.Contains("OK|"))
                {
                    string id = responseString.Substring(3);

                   //Get the Result with id...
               
                }
                else
                {
                   //ErrorHandling
                }
            }
            catch (Exception ex)
            {
                //ErrorHandling

            }
        }

I hope i could help you little bit with this. Have a nice day
thanks a lot. it great
 

Users Who Are Viewing This Thread (Total: 1, Members: 0, Guests: 1)