how to do it? could you share with meOk, i've figured it out by myself now, if anybody need help with this just ask or send pm
i try it before too. but it return empty audio. it is great if you can give me C# sample.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.
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
}
}
thanks a lot. it greatHello, 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
Код: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