Entwickler-Ecke
Internet / Netzwerk - Idhhtp merkwürdige Post Daten
Airtrox - Fr 11.12.09 14:56
Titel: Idhhtp merkwürdige Post Daten
Hallo,
ich möchte mich via idhttp auf eine Seite einloggen. Die Post Daten habe ich mit HttpFox ausgelesen, jedoch finde ich sie etwas komisch:
Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
| -----------------------------14688134019749 Content-Disposition: form-data; name="email"
die_email -----------------------------14688134019749 Content-Disposition: form-data; name="password"
das_passwort -----------------------------14688134019749 Content-Disposition: form-data; name="action"
Login -----------------------------14688134019749-- |
Das gibt er unter Raw aus, unter Pretty sieht es dann so aus:
Quelltext
1: 2: 3:
| email=die_email password=das_passwort action=Login |
Wenn ich diese Daten (in einer stringlist) an die entsprechende Seite weitergebe, schlägt der Login fehl.
Die obigen Nummern finde ich übrigens nirgends im Quelltext.
Falls der Quelltext helfen könnte:
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:
| <FORM ACTION="/?p=userarea&location=login" ENCTYPE="multipart/form-data" METHOD="POST" NAME="login_form" STYLE="display: inline;" onSubmit="window.setTimeout('DisableForm(\''+this.name+'\');', 1); return(true);"> <TABLE CLASS="FORM" BORDER="0" CELLSPACING="1" CELLPADDING="0" WIDTH="646"> <TR> <TH ALIGN="LEFT" WIDTH="644">
<H1>Mitglieder Login</H1> </TH> </TR> <TR> <TD ALIGN="CENTER" WIDTH="644"> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="5" STYLE="margin-top: 5px; margin-bottom: 5px;"> <TR> <TD ALIGN="RIGHT" WIDTH="150"></TD>
<TD ALIGN="LEFT"> <P STYLE="width: 400px;"><SPAN CLASS="SUCCESS">Bitte geben Sie Ihre Login Daten an.</SPAN></P> </TD> </TR> <TR> <TD ALIGN="CENTER" COLSPAN="2"><HR></TD> </TR> <TR>
<TD ALIGN="RIGHT"> <P><B>E-Mail Adresse:</B></P> </TD> <TD ALIGN="LEFT"> <INPUT TYPE="TEXT" CLASS="TEXT" NAME="email" MAXLENGTH="64" SIZE="55" STYLE="width: 320px;" VALUE="" onFocus="this.select(); return(true);"> </TD> </TR> <TR>
<TD ALIGN="RIGHT"> <P><B>Passwort:</B></P> </TD> <TD ALIGN="LEFT"> <INPUT TYPE="PASSWORD" CLASS="TEXT" NAME="password" MAXLENGTH="64" SIZE="55" STYLE="width: 320px;" VALUE="" onFocus="this.select(); return(true);"> </TD> </TR> <TR>
<TD ALIGN="CENTER" COLSPAN="2"><HR></TD> </TR> <TR> <TD ALIGN="RIGHT"> <P> </P> </TD> <TD ALIGN="LEFT"> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="320"> <TR>
<TD ALIGN="RIGHT"> <INPUT TYPE="SUBMIT" CLASS="BUTTON" NAME="action" STYLE="width: 76px;" VALUE="Login"> </TD> </TR> </TABLE> </TD> </TR> </TABLE> </TD>
</TR> </TABLE> </FORM> |
Liegt das nun an der Seite, oder an diesen merkwürdigen Zahlen (oben). Diese verändern sich übrigens jedes mal wenn ich mich einlogge.
Xentar - Fr 11.12.09 15:17
Ich glaube, dein Code könnte da eher helfen..
Airtrox - Fr 11.12.09 15:33
an meinem code ist eigentlich nichts umgewöhnliches:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16:
| var list : tstringlist; code : string; begin form1.IdHTTP1.AllowCookies := true; form1.IdHTTP1.HandleRedirects := true; form1.IdHTTP1.Request.UserAgent := 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10'; list := tstringlist.create; try list.Add('email='+edit1.text); list.Add('password='+edit2.text); list.add('action=Login'); code := form1.idhttp1.post('http://****/?p=userarea&location=account', list); if (pos('Willkommen', code) = 0) then showmessage('Erfolgreich') else showmessage('Nicht erfolgreich'); finally list.Free; end; |
Xentar - Fr 11.12.09 15:40
Hast du auch nen CookieManager, oder wie das Ding heißt?
Martok - Fr 11.12.09 15:42
Man sollte in solchen Fällen auch mal den Content-Type mitlesen ;)
XML-Daten
1:
| <FORM ACTION="/?p=userarea&location=login" ENCTYPE="multipart/form-data" METHOD="POST" NAME="login_form" STYLE="display: inline;" onSubmit="window.setTimeout('DisableForm(\''+this.name+'\');', 1); return(true);"> |
Damit dein Request genauso aussieht, musst du (wie auch immer, Dok lesen hilft) dem IdHTTP sagen dass er genau diesen verwenden soll.
Das tut aber eigentlich nichts zur Sache, da das eh nur für die Übertragung eine Rolle spielt.
Dein Problem dürfte tatsächlich eher das sein:
Xentar hat folgendes geschrieben : |
| Hast du auch nen CookieManager, oder wie das Ding heißt? |
Airtrox - Fr 11.12.09 16:01
Ich habe es mal mit dem IdCookieManager ausprobiert(auch bei idhttp angegeben), jedoch klappt es immer noch nicht.
edit: beim cookiemanager habe ich das angegeben:
Delphi-Quelltext
1: 2: 3: 4: 5:
| procedure TForm1.IdCookieManager1NewCookie(ASender: TObject; ACookie: TIdCookieRFC2109; var VAccept: Boolean); begin acookie.Path := '\' end; |
Martok - Fr 11.12.09 16:46
Airtrox hat folgendes geschrieben : |
edit: beim cookiemanager habe ich das angegeben:
Delphi-Quelltext 1: 2: 3: 4: 5:
| procedure TForm1.IdCookieManager1NewCookie(ASender: TObject; ACookie: TIdCookieRFC2109; var VAccept: Boolean); begin acookie.Path := '\' end; | |
Und warum?
Airtrox - Fr 11.12.09 20:49
gebe ich es nicht an, klappt der login auch nicht...
Airtrox - Mi 03.02.10 23:01
vielleicht kann sich jemand noch mal meinem Problem antun:
Ich habe wieder gesendete Post Daten unter HttpFox(Raw)
Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
| -----------------------------4041360224350 Content-Disposition: form-data; name="title"
TITEL -----------------------------4041360224350 Content-Disposition: form-data; name="group"
1 -----------------------------4041360224350 Content-Disposition: form-data; name="description"
BESCHREIBUNG |
Unter Pretty sieht es dann wieder ganz normal aus (title=TITLE usw)
Ich habe noch etwas gegooglet und herausgefunden, dass TIdMultiPartFormDataStream dafür geeignet wäre. Ob das nun klappt bzw. wie habe ich bisher nicht rausgefunden. Wäre super, wenn ihr mir helfen könntet, dieses Problem treibt mich noch in den Wahnsinn :evil:
edit: Ich hab es nochmal mit IDHttp versucht, Request.ContentType := 'multipart/form-data';
aber leider klappt es immer noch nicht....
matze - So 07.02.10 12:52
du musst in den CookieManager nichts reinschreiben sondern den CookieManager mit deiner HTTP Komponente verbinden!
Entwickler-Ecke.de based on phpBB
Copyright 2002 - 2011 by Tino Teuber, Copyright 2011 - 2026 by Christian Stelzmann Alle Rechte vorbehalten.
Alle Beiträge stammen von dritten Personen und dürfen geltendes Recht nicht verletzen.
Entwickler-Ecke und die zugehörigen Webseiten distanzieren sich ausdrücklich von Fremdinhalten jeglicher Art!