Показать сообщение отдельно
  #1  
Старый 15.09.2012, 20:26
scroyler scroyler вне форума
Активный
 
Регистрация: 01.08.2011
Адрес: ЧЕбоксары
Сообщения: 248
Версия Delphi: XE
Репутация: -615
По умолчанию Не задает вопрос на спрашивай

Код:
 function FindID(strB,strE,str:string):string;
var
  b,e:integer;
begin
  b:=pos(strb,str)+Length(strb);
  e:=pos(strE,str);
  if (b=0)or(e=0) then
    Result:=''
  else
    Result:=copy(str,b,e-b);
end;


procedure TForm1.Button1Click(Sender: TObject);
var
  Data:TStringList;
  Request:String;
  id1,id2:string;
begin
  Data:=TStringList.Create;
  Request:=idHTTP1.Get('http://sprashivai.ru/questions');
  id1:=FindID('<button id="askform-button" class="button-yellow-small" style="width: 134px;" onclick="ask(''questions'', ''',''');">'+AnsiToUtf8('Спросить')+'</button>',Request);
  id2:=FindID('<div id="textarea-ios-fix"></div><input type="hidden" name="asking_hash" value="','" id="asking_hash" />',Request);
   Data.Add(id1+'='+id2);
   data.Add('username'+'='+'konstantin_delphi');
   data.Add('question'+'='+'texxt');
   data.Add('anonimous'+'='+'undefined') ;
   data.Add('capctha'+'='+'')  ;
   idhttp1.Post('http://sprashivai.ru/questions/ask',Data);
end;
end.

Что не так? Кто подскажет?
__________________
Ставь спасибо за спасибо!
Помог?Ставь спасибо!Увидел пост? Поставь спасибо!
Ответить с цитированием