Autor Beitrag
Yooda
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 68



BeitragVerfasst: Fr 09.01.04 13:17 
Hallo Ihr alle !


Ich habe folgendes Problem:
Ich möchte gerne einen Text an ein Php-Script senden. Leider kann der text bis zu 65536 Zeichen enthalten. Mit Webbrowser1.Navigate klappt es nicht, da der Text scheinbar zu lang ist. Mit idhttp bekomme ich eine Fehlermeldung ..http.. not found (oder sowas). mache ich den text kleiner
kommt diese Fehlermeldung nicht mehr. Nun habe ich das so gelöst:
Ich habe eine inifile wo ich den Text aus Memo1 so aufliste:

[ARTICLE_DESC_COUNT]
VALUE=2
[ARTICLE_DESC_LONG]
VALUE[0]=Das ist ein schöner Artikel
VALUE[1]=Das ist auch ein schöner Artikel



nun lese ich mit einer schleife diese werte aus und sende die an das script.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
     for j:=0 to strtoint(inifile.ReadString('ARTICLE_DESC_COUNT','VALUE',''))-1 do
        begin
        Form7.Shape1.Brush.Color:= clred;
        Form7.Shape1.Repaint;
        Form1.Webbrowser1.Navigate('http://192.168.2.4/index.php?command=update&ARTICLE_DESC_LONG='+inifile.Readstring('ARTICLE_DESC_LONG','VALUE['+ inttostr(j) +']','')+'&ARTICLE_NO='+ARTICLE_NO);
        sleep(300);
        Form7.Shape1.Brush.Color:= clwhite;
        Form7.Shape1.Repaint;
        end;
    inifile.Free;
    Memo1.Clear;
    end;
    Button1.Visible:=true;
    Form7.Shape1.Brush.Color:= clwhite;
    Application.Terminate;


dieses macht dann im abstand von 700 ms das update. Das ist leider eine sch* Methode, weil es bei 20 Zeilen schon sehr lange dauert. Habt Ihr eine Idee wie ich es gleichzeitig schnell und "richtig" an den Webserver übertragen kann?


Vielle Grüsse

David

Moderiert von user profile iconDeCodeGuru: Code- durch Delphi-Tags ersetzt...
TimonWorld
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 397



BeitragVerfasst: Sa 10.01.04 19:10 
vieleicht liegt es ja daran dass dein server kein php unterstützt! bei wem bist du???
ixtreme
Gast
Erhaltene Danke: 1



BeitragVerfasst: Sa 10.01.04 20:42 
Versuchs doch mal hier mit...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
uses IdMultipartFormData;

{ .... }

procedure TForm1.Button1Click(Sender: TObject);
var
  data: TIdMultiPartFormDataStream;
begin
  data := TIdMultiPartFormDataStream.Create;
  try
    { add the used parameters for the script }
    data.AddFormField('param1', 'value1');
    data.AddFormField('param2', 'value2');
    data.AddFormField('param3', 'value3');

    { Call the Post method of TIdHTTP and read the result into TMemo }
    Memo1.Lines.Text := IdHTTP1.Post('http://localhost/script.php', data);
  finally
    data.Free;
  end;
end;


Quelle: Swissdelphicenter.ch

Gruß

ixtreme.de
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: So 11.01.04 11:04 
ich meine mal gelesen zu haben, dass die data.AddFormField sache fehler verursacht und nicht richtug funktioniert.
mann kann auch ein memo zum post hernehmen und da einfach pro zeile den variablennamen mit einem = getrennt vom wert reinschreiben.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: So 11.01.04 13:32 
Meinst du www.bla.de/blubb.123...wert1&var2=wert2 usw?
Das ist aber dann ein Get Request.
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mo 12.01.04 16:28 
nein. nimm ein memo und pack da fpolgende zeilen rein:
ausblenden Quelltext
1:
2:
3:
bla1=blabla
bla2=blabla
bla3=blabla


und dann machst du folgendes:IdHTTP1.Post('http://localhost/script.php', memo1.lines);

_________________
In the beginning was the word.
And the word was content-type: text/plain.