Antichat снова доступен.
Форум Antichat (Античат) возвращается и снова открыт для пользователей.
Здесь обсуждаются безопасность, программирование, технологии и многое другое.
Сообщество снова собирается вместе.
Новый адрес: forum.antichat.xyz
Plz Help with Ac-Service captcha recognize |

07.09.2009, 13:15
|
|
Участник форума
Регистрация: 07.01.2009
Сообщений: 186
Провел на форуме: 1247273
Репутация:
166
|
|
Plz Help with Ac-Service captcha recognize
Реально переписать данную функцию с использованием Wininet? Пробовал по-разному, да вот проблемка с загрузкой файла =\
Код:
function recognize(filename: string; apikey: string; is_phrase: boolean; is_regsense: boolean; is_numeric: boolean; min_len: integer; max_len: integer): string;
var
ftype,tmpstr,captcha_id: String;
i: integer;
http: TIdHTTP;
multi: Tidmultipartformdatastream;
begin
if FileExists(filename)=false then begin result:='ERROR: file not found'; exit; end;
ftype:='image/pjpeg';
if strpos(Pchar(filename),'jpg')<>nil then ftype:='image/pjpeg';
if strpos(Pchar(filename),'gif')<>nil then ftype:='image/gif';
if strpos(Pchar(filename),'png')<>nil then ftype:='image/png';
multi:=Tidmultipartformdatastream.Create;
multi.AddFormField('method','post');
multi.AddFormField('key',apikey);
multi.AddFile('file',filename,ftype);
if is_phrase=true then multi.AddFormField('phrase','1');
if is_regsense=true then multi.AddFormField('regsense','1');
if is_numeric=true then multi.AddFormField('numeric','1');
if min_len>0 then multi.AddFormField('min_len',inttostr(min_len));
if max_len>0 then multi.AddFormField('max_len',inttostr(max_len));
http:=TIdHTTP.Create(nil);
tmpstr:=http.Post('http://ac-service.info/in.php',multi);
http.Free;
captcha_id:='';
if strpos(Pchar(tmpstr),'ERROR_')<>nil then begin result:=tmpstr; exit; end;
if strpos(Pchar(tmpstr),'OK|')<>nil then begin captcha_id:=AnsiReplaceStr(tmpstr,'OK|',''); end;
if captcha_id='' then begin result:='ERROR: bad captcha id'; end;
for i:=0 to 20 do
begin
Application.ProcessMessages;
sleep(5000);
http:=TIdHttp.Create(nil);
tmpstr:=http.Get('http://ac-service.info/res.php?key='+apikey+'&action=get&id='+captcha_id);
http.Free;
if strpos(Pchar(tmpstr),'ERROR_')<>nil then begin result:=tmpstr; exit; end;
if strpos(Pchar(tmpstr),'OK|')<>nil then
begin
result:=AnsiReplaceStr(tmpstr,'OK|','');
exit;
end;
Application.ProcessMessages;
end;
result:='ERROR_TIMEOUT';
end;
|
|
|
|
Похожие темы
|
| Тема |
Автор |
Раздел |
Ответов |
Последнее сообщение |
|
Dedicated Server Sale
|
VareZzZ |
Хостинг, Dedicated, VDS, Сервера - Покупка, продажа |
0 |
13.07.2009 21:43 |
|
Аренда:короткие смс номера
|
billing1171 |
Разное - Покупка, продажа, обмен |
95 |
13.02.2009 19:45 |
|
помогите вылечиться от вируса
|
DaTa |
Защита ОС: вирусы, антивирусы, файрволы. |
11 |
30.11.2006 12:10 |
|
отправка на Icq
|
Mefisto |
PHP, PERL, MySQL, JavaScript |
12 |
08.07.2005 11:34 |
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|