Autor Beitrag
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Fr 02.02.07 23:44 
Hallo,

ich möchte eine Seite auslesen, die folgenden Header hat:

ausblenden volle Höhe 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:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
http://www.slashcam.de/cgibin/scripts/dv-kalender.pl

POST /cgibin/scripts/dv-kalender.pl HTTP/1.0
Host: www.slashcam.de
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.9) Gecko/20061206 Firefox/1.5.0.9
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.slashcam.de/cgibin/scripts/dv-kalender.pl
Cookie: __utma=3712626.104115961.1170357579.1170357579.1170448812.2; phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bi%3A-1%3B%7D; __utmz=3712626.1170357579.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); __utmb=3712626; __utmc=3712626; phpbb2mysql_sid=131615c91da38f5d04c1650c357db90b
Content-Type: multipart/form-data; boundary=---------------------------54472172614771
Content-Length: 1161
-----------------------------54472172614771
Content-Disposition: form-data; name="cmd"

view
-----------------------------54472172614771
Content-Disposition: form-data; name="art"

Festival
-----------------------------54472172614771
Content-Disposition: form-data; name="art"

Wettbewerb
-----------------------------54472172614771
Content-Disposition: form-data; name="art"

Messe
-----------------------------54472172614771
Content-Disposition: form-data; name="art"

Kongress
-----------------------------54472172614771
Content-Disposition: form-data; name="art"

Schulung
-----------------------------54472172614771
Content-Disposition: form-data; name="art"

Roadshow
-----------------------------54472172614771
Content-Disposition: form-data; name="art"

Hausmesse
-----------------------------54472172614771
Content-Disposition: form-data; name="zeitraum"

n20
-----------------------------54472172614771
Content-Disposition: form-data; name="near"

88250
-----------------------------54472172614771
Content-Disposition: form-data; name="submit"

   anzeigen   
-----------------------------54472172614771--

HTTP/1.x 200 OK
Date: Fri, 02 Feb 2007 21:11:52 GMT
Server: Apache/2.0.54 (Debian GNU/Linux) DAV/2 PHP/5.2.0-0.dotdeb.3 with Suhosin-Patch proxy_html/2.4 mod_ssl/2.0.54 OpenSSL/0.9.7e mod_perl/1.999.21 Perl/v5.8.4
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 6258
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html


Ich dachte eigentlich, dass das mit Indy nun folgendermaßen gehen sollte (GetGUID erzeugt eine Zufallszahl):

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:
28:
    SGUID := '-----------------------------' + GetGUID;

    lParam.WriteString(SGUID);
    lParam.WriteString('Content-Disposition: form-data; name="cmd"');
    lParam.WriteString('');
    lParam.WriteString('view');

    lParam.WriteString(SGUID);
    lParam.WriteString('Content-Disposition: form-data; name="art"');
    lParam.WriteString('');
    lParam.WriteString('Festival');

    lParam.WriteString(SGUID);
    lParam.WriteString('Content-Disposition: form-data; name="zeitraum"');
    lParam.WriteString('');
    lParam.WriteString('n20');

    lParam.WriteString(SGUID);
    lParam.WriteString('Content-Disposition: form-data; name="near"');
    lParam.WriteString('');
    lParam.WriteString('88250');

    lParam.WriteString(SGUID);
    lParam.WriteString('Content-Disposition: form-data; name="submit"');
    lParam.WriteString('');
    lParam.WriteString('   anzeigen   ');

    lParam.WriteString(SGUID + '--');

ausblenden Delphi-Quelltext
1:
2:
3:
4:
    IdHTTP.Request.ContentType   := 'multipart/form-data; boundary=' + SGUID;
    IdHTTP.Request.ContentLength := lParam.Size;

    IdHTTP.Request.Referer := 'http://www.slashcam.de/cgibin/scripts/dv-kalender.pl';

Aber der zurückgegebene Source, entspricht nicht dem gewünschten Source. Vermutlich akzeptiert der Server die Anfrage nicht.

Seht ihr da irgendwo meinen Fehler? Ich versuch jetzt mal den Netzwerk-Verkehr mit Ethereal aufzuzeichnen.

Grüße
GTA-Place


EDIT: Es liegt vermutlich daran, dass WriteString ja keine Leerzeilen erstellt. Ich muss also erst z.B. eine StringList verwenden und dann in den StringStream übertragen.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 03.02.07 00:13 
Hat sich erledigt. Es lag wirklich an den Leerzeilen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
    ParList.Add(SGUID);
    ParList.Add('Content-Disposition: form-data; name="cmd"');
    ParList.Add(#13#10);
    ParList.Add('view');

// ... //

    lParam.WriteString(ParList.Text);


Trotzdem danke.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.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: Sa 03.02.07 11:11 
Dafür gibts doch auch ne extra Indy Klasse mit der du das alles machen kannst: TIdMultiPartFormDataStream
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 03.02.07 11:39 
Danke für den Tipp, aber es sind zu wenig Striche vor der GUID:
ausblenden Quelltext
1:
----------020307103344265					

Kann man das irgendwo einstellen? Wäre sonst super, aber wenn das zu kurz ist, scheint es nicht zu gehen.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.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: Sa 03.02.07 12:02 
was? Das wäre mir ja ganze neu, dass das von der Anzahl der Striche abhängt.
Im Zweifelsfall musst du das im Source der Indys umbauen.
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 03.02.07 12:34 
Dann merk dir das mal :mrgreen:. Es war wirklich die Anzahl der Striche. Ich hab das ganze nun im Indy-Source dynamisch gemacht und siehe da, bei 29 Strichen funktioniert es.

Nochmal Danke für den Tipp.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.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: Sa 03.02.07 12:56 
Ich lass mich da ja gerne eines besseren belehren.
Wohin schickst du denn die Daten? PHP, Apache, oder wie sieht die Konstellation aus, an die du die Daten schickst?
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 03.02.07 13:03 
Per IdHTTP.Post() and eine Perl-Datei (*.pl).

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.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: Sa 03.02.07 16:00 
hmmm.. ich hätte jetzt was exotisches erwartet, das das mit den Strichen erklärt.

Tja... man lernt halt doch nie aus. :D