Hallo,
und zwar möchte ich gerne bei einer Seite ein Formular übertragen. Dieses Formular "arbeitet" nicht mit normalen POSTs, sondern mit den Boundarys. Nun habe ich also den Boundary-Content nachgestellt und via WebRequest abgeschickt. Allerdings akzeptiert die Seite anscheinend meinen POST nicht, da ich im Quelltext keine Bestätigung finden kann, die normalerweise fest auf der Seite ist bei einem erfolgreichen Eintrag.
LiveHTTPHeader-Ausschnitt:
Spoiler anzeigen
Hier mein WebRequest für den Login:
Spoiler anzeigen
So setze ich den Login ein: (funktioniert auch einwandfrei, also Login wird auf jedenfall übernommen.)
Spoiler anzeigen
Und hier mein WebRequest für das Eintrag-Formular:
Spoiler anzeigen
So setze ich es ein:
Beide Requests nutzen den folgenden Cookiecontainer: (Da sollte ja kein Fehler liegen, Login funktioniert ja.)
Ich bin so langsam wirklich ratlos, eine Fehlerquelle die ich mir vorstellen könnte wäre die im Original 15 stellige Zahl, die bei den Boundary-Posts vorkommt. Leider weiß ich nicht wie ich diese nachstelle. Aber ansonsten sollte soweit doch alles richtig sein?
Ich hoffe es kann mir jemand helfen
Vielen Dank im voraus,
mewcrazy
und zwar möchte ich gerne bei einer Seite ein Formular übertragen. Dieses Formular "arbeitet" nicht mit normalen POSTs, sondern mit den Boundarys. Nun habe ich also den Boundary-Content nachgestellt und via WebRequest abgeschickt. Allerdings akzeptiert die Seite anscheinend meinen POST nicht, da ich im Quelltext keine Bestätigung finden kann, die normalerweise fest auf der Seite ist bei einem erfolgreichen Eintrag.
LiveHTTPHeader-Ausschnitt:
XML-Quellcode
- http://www."google.de"/ui.php?ua=tvshow&do=add
- POST /ui.php?ua=tvshow&do=add HTTP/1.1
- Host: www."google.de"
- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.8;MEGAUPLOAD 1.0
- Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
- 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: 115
- Connection: keep-alive
- Referer: http://www."google.de"/ui.php?ua=tvshow&do=add
- Cookie: lang=de; __utma=227930369.10588397.1284951760.1285532059.1285534788.21; __utmz=227930369.1285251781.4.2.utmcsr=xmarks.com|utmccn=(referral)|utmcmd=referral|utmcct=/topic/stream_seiten; lastview=189518; onlylanguage=de; PHPSESSID=72hdvld86ugv0c6ke173m7aut0; __utmc=227930369; __utmb=227930369.18.10.1285534788
- Content-Type: multipart/form-data; boundary=---------------------------130281863114589
- Content-Length: 4253
- -----------------------------130281863114589
- Content-Disposition: form-data; name="title"
- Alle Hassen Chris
- -----------------------------130281863114589
- Content-Disposition: form-data; name="season"
- 01
- -----------------------------130281863114589
- Content-Disposition: form-data; name="episode"
- 16
- -----------------------------130281863114589
- Content-Disposition: form-data; name="language"
- 2
- -----------------------------130281863114589
- Content-Disposition: form-data; name="hoster"
- 94
- -----------------------------130281863114589
- Content-Disposition: form-data; name="link"
- http://www.filestage.to/watch/08517ad3ecf5562dad2d29aa39e878b4/Alle.hassen.Chris.S01E16.Chris.hasst.die.Gicht_randomanon.avi
- -----------------------------130281863114589
- Content-Disposition: form-data; name="genre1"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="genre2"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="genre3"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="genre4"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="genre5"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="thumbnail"
- upload
- -----------------------------130281863114589
- Content-Disposition: form-data; name="thumbnailfile"; filename=""
- Content-Type: application/octet-stream
- -----------------------------130281863114589
- Content-Disposition: form-data; name="thumbnaillink"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="description"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="duration"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="fsk"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="countryyear"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="director"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="actors"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detail[1]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detailtext[1]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detail[2]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detailtext[2]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detail[3]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detailtext[3]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detail[4]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detailtext[4]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detail[5]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detailtext[5]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detail[6]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detailtext[6]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detail[7]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detailtext[7]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detail[8]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detailtext[8]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detail[9]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="detailtext[9]"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="adtext"
- -----------------------------130281863114589
- Content-Disposition: form-data; name="adlink"
- -----------------------------130281863114589--
- HTTP/1.1 200 OK
- Server: nginx/0.6.32
- Date: Sun, 26 Sep 2010 21:41:09 GMT
- Content-Type: text/html
- Transfer-Encoding: chunked
- Connection: keep-alive
- X-Powered-By: PHP/5.3.2-2
- Expires: Thu, 19 Nov 1981 08:52:00 GMT
- Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
- Pragma: no-cache
- Content-Encoding: gzip
- ----------------------------------------------------------
Hier mein WebRequest für den Login:
VB.NET-Quellcode
- Public Function Req(ByVal Site As String, ByVal Post As String, ByVal Method As String, ByVal Host As String) As String
- Dim CookieCount As Double = 0
- Dim R As HttpWebRequest = HttpWebRequest.Create(Site)
- R.Method = Method
- R.ServicePoint.Expect100Continue = False
- R.CookieContainer = Cookies
- R.Host = Host
- R.MaximumAutomaticRedirections = 20
- R.AllowAutoRedirect = True
- R.Referer = ""
- R.Timeout = 10000
- R.ContentType = "application/x-www-form-urlencoded"
- R.ContentLength = Post.Length
- Dim writer As New IO.StreamWriter(R.GetRequestStream(), System.Text.Encoding.ASCII)
- writer.Write(Post)
- writer.Close()
- Dim Response As HttpWebResponse = DirectCast(R.GetResponse, HttpWebResponse)
- Response.Cookies = R.CookieContainer.GetCookies(R.RequestUri)
- Dim Reader As IO.StreamReader = New IO.StreamReader(Response.GetResponseStream)
- Dim SourceCode As String = Reader.ReadToEnd()
- Debug.Print(SourceCode)
- Reader.Close()
- For Each SetCookie As Cookie In Response.Cookies
- Debug.Print(SetCookie.Name)
- Next
- Return SourceCode
- End Function
So setze ich den Login ein: (funktioniert auch einwandfrei, also Login wird auf jedenfall übernommen.)
VB.NET-Quellcode
- Dim var_movie2kcom_login As String = Req("http://www."google.de"/login.php?ua=login", "username" & User & "&password=" & Passwort, "POST", "www."google.de"")
- If var_movie2kcom_login.Contains("Add a tvshow") Then
- TextBox1.AppendText("Login auf "google.de" erfolgreich!")
- Else : TextBox1.AppendText("Login auf "google.de" fehlgeschlagen!")
- End If
Und hier mein WebRequest für das Eintrag-Formular:
VB.NET-Quellcode
- Public Function webrequest_movie2kcom(ByVal Site As String, ByVal Post As String, ByVal Method As String, ByVal Host As String) As String
- Dim R As HttpWebRequest = HttpWebRequest.Create(Site)
- R.Method = Method
- R.ServicePoint.Expect100Continue = True
- R.CookieContainer = Cookies
- R.Host = Host
- R.MaximumAutomaticRedirections = 200
- R.AllowAutoRedirect = True
- R.Referer = "http://www."google.de"/ui.php?ua=tvshow&do=add"
- R.Timeout = 10000
- R.Headers("useragent") = "Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"
- R.ContentType = "Content-Type: multipart/form-data; boundary=---------------------------" & TimeHash
- R.ContentLength = Post.Length
- Dim writer As New IO.StreamWriter(R.GetRequestStream(), System.Text.Encoding.ASCII)
- writer.Write(Post)
- writer.Close()
- Dim Response As HttpWebResponse = DirectCast(R.GetResponse, HttpWebResponse)
- Response.Cookies = R.CookieContainer.GetCookies(R.RequestUri)
- Dim Reader As IO.StreamReader = New IO.StreamReader(Response.GetResponseStream)
- Dim SourceCode As String = Reader.ReadToEnd()
- Debug.Print(SourceCode)
- Reader.Close()
- For Each SetCookie As Cookie In Response.Cookies
- Debug.Print(SetCookie.Name)
- Next
- Return SourceCode
- End Function
So setze ich es ein:
Beide Requests nutzen den folgenden Cookiecontainer: (Da sollte ja kein Fehler liegen, Login funktioniert ja.)
Ich bin so langsam wirklich ratlos, eine Fehlerquelle die ich mir vorstellen könnte wäre die im Original 15 stellige Zahl, die bei den Boundary-Posts vorkommt. Leider weiß ich nicht wie ich diese nachstelle. Aber ansonsten sollte soweit doch alles richtig sein?
Ich hoffe es kann mir jemand helfen
Vielen Dank im voraus,
mewcrazy
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „mewcrazy“ ()