Autor Beitrag
florida
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 137

Windows 7 Home Premium, Windows XP Professional, Windows 2000
Delphi 2010 Architect
BeitragVerfasst: Fr 29.07.11 18:32 
Hallo liebe Community,

ich bin bei wunschbox.cc angemeldet und habe dort ein Gästebuch. Kann ich mit einem Delphi-Programm Einträge zu diesem Gästebuch schicken oder brauche ich da PHP?


Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Fr 29.07.2011 um 19:36
glotzer
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 393
Erhaltene Danke: 49

Win 7
Lazarus
BeitragVerfasst: Fr 29.07.11 18:43 
ja kannst du.

_________________
ja, ich schreibe grundsätzlich alles klein und meine rechtschreibfehler sind absicht

Für diesen Beitrag haben gedankt: BenBE
florida Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 137

Windows 7 Home Premium, Windows XP Professional, Windows 2000
Delphi 2010 Architect
BeitragVerfasst: Fr 29.07.11 19:10 
user profile iconglotzer hat folgendes geschrieben Zum zitierten Posting springen:
ja kannst du.


Und wie?
glotzer
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 393
Erhaltene Danke: 49

Win 7
Lazarus
BeitragVerfasst: Fr 29.07.11 19:20 
mit delphi.

such mal nach "indys" da findest du alles was du brauchst

_________________
ja, ich schreibe grundsätzlich alles klein und meine rechtschreibfehler sind absicht
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8553
Erhaltene Danke: 479

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 29.07.11 19:38 
Um es etwas genauer zu sagen: Das Gästebuch-Formular wird ja auch nichts anderes machen, als per POST die Daten an das dahinterliegende Script zu schicken. Und genau dieses "Posten" kann man auch mit Delphi machen - dafür gibt es die Indy-Komponenten. Da nimmst du dann die Indy-HttpClient-Komponente, packst die zu postenden Daten in eine Liste oder Stream und rufst dann die Methode Idhttp1.Post mit den passenden Parametern auf. :)

_________________
We are, we were and will not be.
florida Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 137

Windows 7 Home Premium, Windows XP Professional, Windows 2000
Delphi 2010 Architect
BeitragVerfasst: Sa 30.07.11 08:30 
Ich habe es jetzt so gemacht.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
var
  data: TStringList;
  s: String;
begin
  data := TStringList.Create;
  try
    data.Values['name'] := 'NameProbe';
    data.Values['song'] := 'SongProbe';
    data.Values['gruss'] := 'GrussProbe';
    try
      s := IdHTTP1.Post(
        'http://wunschbox.cc/wunschbox?id=x;uid=1436', data);
      Memo1.Lines.Add(s);
    except
      on E: Exception do
        ShowMessage('Fehler: ' + E.Message);
    end;
  finally
    data.Free;
  end;


In diesem Fall kommt aber der Runtime-Error "Forbidden".
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 30.07.11 09:26 
Du hast ein & in der Parameterliste vergessen:
ausblenden Quelltext
1:
http://wunschbox.cc/wunschbox?id=x&uid=1436					


Hast du schon mal den Netzwerkverkehr zum Beispiel mit Firebug oder Wireshark mitgeschnitten um zu sehen was die Seite so alles überträgt?
florida Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 137

Windows 7 Home Premium, Windows XP Professional, Windows 2000
Delphi 2010 Architect
BeitragVerfasst: Sa 30.07.11 13:15 
Gut, habe mich gerade eben nochmal damit beschäftigt und habe es nun hinbekommen.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
var
  data: TStringList;
  s: String;
begin
  data := TStringList.Create;
  try
    data.Values['name'] := NameEdit.Text;
    data.Values['song'] := SongEdit.Text;
    data.Values['gruss'] := GreetsEdit.Text;
    data.Values['send'] := 'click';
    try
      IdHTTP.Request.UserAgent :=
        'Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 6.1)';
      s := IdHTTP.Post(
        'http://wunschbox.cc/wunschbox?id=x&uid=1436', data);
      LogMemo.Clear;
      LogMemo.Lines.Add(s);
      LogMemo.Lines.SaveToFile(ExtractFilePath(Application.ExeName)
          + 'probe.html');
    except
      on E: Exception do
        ShowMessage('Fehler: ' + E.Message);
    end;
  finally
    data.Free;
  end;
end;