Copy POST HTTP
Url : https://anticaptcha.top/api/captcha
Content-Type : application/json
{
"apikey" : "YOUR_API_KEY" ,
"img" : "/9j/4AAQSkZJRgABAQEASABIAAD...|/9j/4DSJFHKSDJDS..." ,
"type" : 26 // id của loại captcha shopee slide
}
2. Kết quả trả về/Response
C# PHP Curl Javascript Jquery AJAX
Copy public class CatpchaResult
{
public string log { get ; set ; }
public bool status { get ; set ; }
public string catcha { get ; set ; }
}
public class AnticaptchaTopApi
{
public string apiKey = "" ;
public string Post ( string url , object data , string method = "POST" )
{
int num = 0 ;
NameValueCollection values;
while (num < 1 )
{
try
{
using ( WebClient webClient = new WebClient ())
{
values = new NameValueCollection ();
if (data != null )
{
data .GetType().GetProperties().ToList().ForEach( delegate ( PropertyInfo pi)
{
values .Add( pi . Name , ( pi .GetValue(data , null ) ?? "" ).ToString());
});
byte [] bytes = webClient .UploadValues(url , method , values);
return Encoding . UTF8 .GetString(bytes);
}
return webClient .DownloadString(url);
}
}
catch
{
}
}
return "" ;
}
public CatpchaResult GetCatpcha ( string img , int type)
{
var data = new
{
apikey = apiKey ,
type = type ,
img = img
};
var rs = new CatpchaResult
{
status = false
};
try
{
var result = JsonConvert .DeserializeObject <dynamic> (Post( "https://anticaptcha.top/api/captcha" , data));
if ( result . success == true )
{
rs . status = true ;
rs . catcha = result . captcha ;
rs . log = result . message ;
}
}
catch
{
}
return rs;
}
}
Copy <? php
$curl = curl_init () ;
curl_setopt_array ( $curl , array(
CURLOPT_URL => "https://anticaptcha.top/api/captcha" ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => "" ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 30 ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => "POST" ,
CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"apikey\"\r\n\r\n[apikey]\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\n26\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"img\"\r\n\r\n[Base64 ảnh mask]|[Base64 ảnh background]\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache" ,
"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
) ,
) ) ;
$response = curl_exec ( $curl ) ;
$err = curl_error ( $curl ) ;
curl_close ( $curl ) ;
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Copy var form = new FormData ();
form .append ( "apikey" , "[apikey]" );
form .append ( "type" , "26" );
form .append ( "img" , "[Base64 ảnh mask]|[Base64 ảnh background]" );
var settings = {
"async" : true ,
"crossDomain" : true ,
"url" : "https://anticaptcha.top/api/captcha" ,
"method" : "POST" ,
"headers" : {
"cache-control" : "no-cache"
} ,
"processData" : false ,
"contentType" : false ,
"mimeType" : "multipart/form-data" ,
"data" : form
}
$ .ajax (settings) .done ( function (response) {
console .log (response);
});
Lưu ý : Nên sử dụng phần mềm PostMan để kiểm tra chạy test trước