Name | Type | Description |
---|---|---|
username | string | User's API username. Each user can find his API Username at the Dashboard within his account at our website |
password | string | User's API password. Each user can find his API Password at the Dashboard within his account at our website |
function | string |
Command to execute. Possible values:
balance - Used mainly for testing the authentication and integration between our API and the software/application. Returns the number of allowed Captcha Threads according to the user's plan. picture2 - Submit Captcha image for solving/decoding. It is very important to use multipart headers, by sending the following headers: Content-Type: multipart/form-data |
pict | file |
The captcha image that needs to be solved/decoded
This variable is used only when performing a function=picture2 command for Captcha solving! Only accepted images are from the following types: image/png, image/jpeg, image/gif, image/bmp, image/x-ms-bmp |
<form method="post" action="http://api.captchatronix.com/" enctype="multipart/form-data"> <input type="hidden" name="function" value="picture2"> Username: <input type="text" name="username" value="YOUR_API_USERNAME_HERE"> Password: <input type="text" name="password" value="YOUR_API_PASSWORD_HERE"> Captcha Image: <input type="file" name="pict"> <input type="submit" value="Send"> </form>
curl http://api.captchatronix.com/ -F function=picture2 -F username=YOUR_API_USERNAME_HERE -F password=YOUR_API_PASSWORD_HERE -F pict=@/path/to/captcha.jpg
curl.exe http://api.captchatronix.com/ -F function=picture2 -F username=YOUR_API_USERNAME_HERE -F password=YOUR_API_PASSWORD_HERE -F pict=@c:\path\to\captcha.jpg
<?php $postData=array(); $postData['username']='YOUR_API_USERNAME_HERE'; $postData['password']='YOUR_API_PASSWORD_HERE'; $postData['function']='balance'; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,'http://api.captchatronix.com/'); curl_setopt($ch,CURLOPT_HEADER,0); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,$postData); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5); curl_setopt($ch,CURLOPT_TIMEOUT,20); $response=curl_exec($ch); curl_close($ch); echo $response; ?>
<?php $filename='/path/to/your/image.png'; $postData=array(); $postData['username']='YOUR_API_USERNAME_HERE'; $postData['password']='YOUR_API_PASSWORD_HERE'; $postData['function']='picture2'; $postData['pict']='@'.realpath($filename); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,'http://api.captchatronix.com/'); curl_setopt($ch,CURLOPT_HEADER,0); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_HTTPHEADER,array('Content-Type: multipart/form-data')); curl_setopt($ch,CURLOPT_POSTFIELDS,$postData); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5); curl_setopt($ch,CURLOPT_TIMEOUT,20); $response=curl_exec($ch); curl_close($ch); echo $response; ?>
#!/usr/bin/env python import requests api_url="http://api.captchatronix.com/" api_username="YOUR_API_USERNAME_HERE" api_password="YOUR_API_PASSWORD_HERE" # FUNCTION TO CHECK INTEGRATION (function=balance) def get_balance(): global api_url,api_username,api_password; data = {"function": "balance", "username": api_username, "password": api_password} request = requests.post(api_url, data) return float(request.content) # FUNCTION TO CHECK INTEGRATION (function=balance) # FUNCTION TO SOLVE CAPTCHA (function=picture2) def solve_captcha(captcha_image=""): global api_url,api_username,api_password; data = {"function": "picture2", "username": api_username, "password": api_password} files={'pict': open(captcha_image, 'rb')} request = requests.post(api_url,files=files,data=data) answer = request.content.split("|")[-1] return answer # FUNCTION TO SOLVE CAPTCHA (function=picture2) # USAGE OF THE FUNCTIONS balance = get_balance() print(balance) solved=solve_captcha("/path/to/your/image.png") print(solved)
#!/usr/bin/perl use warnings; use strict; use LWP::UserAgent; use HTTP::Request::Common; my $api_url='http://api.captchatronix.com/'; my $api_username='YOUR_API_USERNAME_HERE'; my $api_password='YOUR_API_PASSWORD_HERE'; # FUNCTION TO CHECK INTEGRATION (function=balance) sub get_balance { my $ua = LWP::UserAgent->new(); my $response = $ua->request(POST $api_url, Content_Type => 'form-data', Content => [ function => 'balance', username => $api_username, password => $api_password, ]); if ($response->is_error()) { return $response->status_line; } else { return $response->content(); } } # FUNCTION TO CHECK INTEGRATION (function=balance) # FUNCTION TO SOLVE CAPTCHA (function=picture2) sub solve_captcha { my $ua = LWP::UserAgent->new(); my $response = $ua->request(POST $api_url, Content_Type => 'multipart/form-data', Content => [ function => 'picture2', username => $api_username, password => $api_password, pict =>[$_[0]] ]); if ($response->is_error()) { return $response->status_line; } else { return $response->content(); } } # FUNCTION TO SOLVE CAPTCHA (function=picture2) # USAGE OF THE FUNCTIONS printf get_balance(); printf "\n"; printf solve_captcha("/path/to/your/image.png");
Dim API_Username As String = "YOUR_API_USERNAME_HERE" Dim API_Password As String = "YOUR_API_PASSWORD_HERE" Try Dim wb As WebClient = New WebClient wb.Proxy = Nothing Dim reqparm As New Specialized.NameValueCollection reqparm.Add("function", "balance") reqparm.Add("username", API_Username) reqparm.Add("password", API_Password) Dim responsebytes = wb.UploadValues("http://api.captchatronix.com/", "POST", reqparm) Dim responsebody = (New System.Text.UTF8Encoding).GetString(responsebytes) MsgBox(responsebody) Catch ex As WebException End Try
Dim API_Username As String = "YOUR_API_USERNAME_HERE" Dim API_Password As String = "YOUR_API_PASSWORD_HERE" Dim reqparm As New Specialized.NameValueCollection reqparm.Add("function", "picture2") reqparm.Add("username", API_Username) reqparm.Add("password", API_Password) Dim Result As String=MultiPartURLRequest("http://api.captchatronix.com/","C:\image.png",reqparm) MsgBox(Result) Public Function MultiPartURLRequest(url As String, file As String, nvc As Specialized.NameValueCollection) As String Dim length As Long = 0 Dim boundary As String = "----------------------------" & DateTime.Now.Ticks.ToString("x") Dim httpWebRequest2 As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest) httpWebRequest2.ContentType = "multipart/form-data; boundary=" & boundary httpWebRequest2.Method = "POST" httpWebRequest2.KeepAlive = True httpWebRequest2.Credentials = System.Net.CredentialCache.DefaultCredentials Dim memStream As Stream = New System.IO.MemoryStream() Dim boundarybytes As Byte() = System.Text.Encoding.ASCII.GetBytes(vbCr & vbLf & "--" & boundary & vbCr & vbLf) Dim formdataTemplate As String = vbCr & vbLf & "--" & boundary & vbCr & vbLf & "Content-Disposition: form-data; name=""{0}"";" & vbCr & vbLf & vbCr & vbLf & "{1}" For Each key As String In nvc.Keys Dim formitem As String = String.Format(formdataTemplate, key, nvc(key)) Dim formitembytes As Byte() = System.Text.Encoding.UTF8.GetBytes(formitem) memStream.Write(formitembytes, 0, formitembytes.Length) Next memStream.Write(boundarybytes, 0, boundarybytes.Length) Dim headerTemplate As String = "Content-Disposition: form-data; name=""{0}""; filename=""{1}""" & vbCr & vbLf & " Content-Type: application/octet-stream" & vbCr & vbLf & vbCr & vbLf Dim header As String = String.Format(headerTemplate, "pict", file) Dim headerbytes As Byte() = System.Text.Encoding.UTF8.GetBytes(header) memStream.Write(headerbytes, 0, headerbytes.Length) Dim fileStream As New FileStream(file, FileMode.Open, FileAccess.Read) Dim buffer As Byte() = New Byte(1023) {} Dim bytesRead As Integer = 0 While (InlineAssignHelper(bytesRead, fileStream.Read(buffer, 0, buffer.Length))) <> 0 memStream.Write(buffer, 0, bytesRead) End While memStream.Write(boundarybytes, 0, boundarybytes.Length) fileStream.Close() httpWebRequest2.ContentLength = memStream.Length Dim requestStream As Stream = httpWebRequest2.GetRequestStream() memStream.Position = 0 Dim tempBuffer As Byte() = New Byte(CInt(memStream.Length - 1)) {} memStream.Read(tempBuffer, 0, tempBuffer.Length) memStream.Close() requestStream.Write(tempBuffer, 0, tempBuffer.Length) requestStream.Close() Dim webResponse2 As WebResponse = httpWebRequest2.GetResponse() Dim stream2 As Stream = webResponse2.GetResponseStream() Dim reader2 As New StreamReader(stream2) Dim Result As String = reader2.ReadToEnd() webResponse2.Close() httpWebRequest2 = Nothing webResponse2 = Nothing Return Result End Function Public Function InlineAssignHelper(Of T)(ByRef target As T, value As T) As T target = value Return value End Function
string API_Username = "YOUR_API_USERNAME_HERE"; string API_Password = "YOUR_API_PASSWORD_HERE"; try { WebClient wb = new WebClient(); wb.Proxy = null; System.Collections.Specialized.NameValueCollection reqparm = new System.Collections.Specialized.NameValueCollection(); reqparm.Add("function", "balance"); reqparm.Add("username", API_Username); reqparm.Add("password", API_Password); dynamic responsebytes = wb.UploadValues("http://api.captchatronix.com/", "POST", reqparm); dynamic responsebody = (new System.Text.UTF8Encoding()).GetString(responsebytes); Interaction.MsgBox(responsebody); } catch (WebException ex) { }
string API_Username = "YOUR_API_USERNAME_HERE"; string API_Password = "YOUR_API_PASSWORD_HERE"; System.Collections.Specialized.NameValueCollection reqparm = new System.Collections.Specialized.NameValueCollection(); reqparm.Add("function", "picture2"); reqparm.Add("username", API_Username); reqparm.Add("password", API_Password); string Result = MultiPartURLRequest("http://api.captchatronix.com/", "C:\\image.png", reqparm); Interaction.MsgBox(Result); public string MultiPartURLRequest(string url, string file, System.Collections.Specialized.NameValueCollection nvc) { long length = 0; string boundary = "----------------------------" + DateTime.Now.Ticks.ToString("x"); HttpWebRequest httpWebRequest2 = (HttpWebRequest)WebRequest.Create(url); httpWebRequest2.ContentType = "multipart/form-data; boundary=" + boundary; httpWebRequest2.Method = "POST"; httpWebRequest2.KeepAlive = true; httpWebRequest2.Credentials = System.Net.CredentialCache.DefaultCredentials; Stream memStream = new System.IO.MemoryStream(); byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes(Constants.vbCr + Constants.vbLf + "--" + boundary + Constants.vbCr + Constants.vbLf); string formdataTemplate = Constants.vbCr + Constants.vbLf + "--" + boundary + Constants.vbCr + Constants.vbLf + "Content-Disposition: form-data; name=\"{0}\";" + Constants.vbCr + Constants.vbLf + Constants.vbCr + Constants.vbLf + "{1}"; foreach (string key in nvc.Keys) { string formitem = string.Format(formdataTemplate, key, nvc[key]); byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem); memStream.Write(formitembytes, 0, formitembytes.Length); } memStream.Write(boundarybytes, 0, boundarybytes.Length); string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"" + Constants.vbCr + Constants.vbLf + " Content-Type: application/octet-stream" + Constants.vbCr + Constants.vbLf + Constants.vbCr + Constants.vbLf; string header = string.Format(headerTemplate, "pict", file); byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header); memStream.Write(headerbytes, 0, headerbytes.Length); FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read); byte[] buffer = new byte[1024]; int bytesRead = 0; while (bytesRead=fileStream.Read(buffer, 0, buffer.Length)) != 0) { memStream.Write(buffer, 0, bytesRead); } memStream.Write(boundarybytes, 0, boundarybytes.Length); fileStream.Close(); httpWebRequest2.ContentLength = memStream.Length; Stream requestStream = httpWebRequest2.GetRequestStream(); memStream.Position = 0; byte[] tempBuffer = new byte[Convert.ToInt32(memStream.Length - 1) + 1]; memStream.Read(tempBuffer, 0, tempBuffer.Length); memStream.Close(); requestStream.Write(tempBuffer, 0, tempBuffer.Length); requestStream.Close(); WebResponse webResponse2 = httpWebRequest2.GetResponse(); Stream stream2 = webResponse2.GetResponseStream(); StreamReader reader2 = new StreamReader(stream2); string Result = reader2.ReadToEnd(); webResponse2.Close(); httpWebRequest2 = null; webResponse2 = null; return Result; }
SET !EXTRACT_TEST_POPUP NO TAB T=1 URL GOTO=http://api.captchatronix.com/form.html TAG POS=1 TYPE=INPUT ATTR=NAME:username CONTENT=YOUR_API_USERNAME_HERE TAG POS=1 TYPE=INPUT ATTR=NAME:password CONTENT=YOUR_API_PASSWORD_HERE TAG POS=1 TYPE=INPUT ATTR=NAME:pict CONTENT=C:\captcha.jpg TAG POS=1 TYPE=INPUT ATTR=TYPE:submit SET !EXTRACT NULL TAG POS=1 TYPE=HTML ATTR=* EXTRACT=TXT SET CaptchaAnswer {{!EXTRACT}}