Daten aus einer Website einlesen

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Maximilian Hofer

    Daten aus einer Website einlesen

    Hallo NG,

    zum erstellen einer Anfrag an eine Website benutze ich folgenden Code:


    Dim encoding = New System.Text.UTF 8Encoding

    'Daten zum Posten zusammenbauen

    Dim postData As String

    postData = "username=" + TextBox1.Text

    postData += ("&password= " + TextBox2.Text)

    'in ein Byte-Array umwandeln

    Dim data() As Byte

    data = encoding.GetByt es(postData)

    Dim myWebRequest As Net.HttpWebRequ est

    Dim myWebResponse As Net.HttpWebResp onse

    'Website zu der die Anfrage gestelt werden soll

    myWebRequest =
    myWebRequest.Cr eate("https://secure.ycn.com/quickaccess/ycnadsl/phptool.php")

    'POST

    myWebRequest.Me thod = "POST"

    myWebRequest.Co ntentType = "applicatio n/x-www-form-urlencoded"

    myWebRequest.Co ntentLength = data.Length

    Dim NewStream As System.IO.Strea m

    NewStream = myWebRequest.Ge tRequestStream( )

    NewStream.Write (data, 0, data.Length)

    NewStream.Close ()

    'Abschicken...

    myWebResponse = myWebRequest.Ge tResponse()

    NewStream = myWebResponse.G etResponseStrea m()





    Das scheint auch zu funktionieren, doch wie kann ich die Daten die mir die
    Website zurückliefert z.B. in ein String einlesen?





    mfg



    MAx


  • Crouchie1998

    #2
    RE: Daten aus einer Website einlesen

    What are your questions in ENGLISH or are you just promoting something?

    Comment

    • Cor Ligthert

      #3
      Re: Daten aus einer Website einlesen

      Maximilian,

      Can you show us how and where you use this code and than with in English
      please.

      Although a major part of the messages (questions and answers) in this
      newsgroup is done by non native English speaking people, is the used
      language English, will you be so kind to do that as well.

      For questions asked in the German Language there are active newsgroups
      microsoft.publi c.de.german.ent wickler.dotnet. vb
      and when it is entwickler ASP
      microsoft.publi c.de.german.ent wickler.dotnet. asp

      I hope this helps?

      Cor



      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: Daten aus einer Website einlesen

        Hallo Maximilian!

        "Maximilian Hofer" <maximilian.hof er@kriegsauer.a t> schrieb:[color=blue]
        > zum erstellen einer Anfrag an eine Website benutze ich folgenden Code:
        >[...]
        >doch wie kann ich die Daten die mir die Website zurückliefert z.B. in ein
        >String einlesen?[/color]

        Beachte, dass dies eine englischsprachi ge Gruppe ist!

        <URL:http://dotnet.mvps.org/dotnet/code/net/#InternetLoadFi le>

        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://classicvb.org/petition/>

        Comment

        • Crouchie1998

          #5
          Re: Daten aus einer Website einlesen

          Are you able to translate the original question for us non German speaking
          people please Herfried?

          Now, if it was in Polish I wouldn't have a problem :)

          Comment

          • Herfried K. Wagner [MVP]

            #6
            Re: Daten aus einer Website einlesen

            Crouchie,

            "Crouchie19 98" <Crouchie1998@d iscussions.micr osoft.com> schrieb:[color=blue]
            > Are you able to translate the original question for us non German speaking
            > people please Herfried?[/color]

            The OP wants to download a file from the web and assign the file's content
            to a string.
            [color=blue]
            > Now, if it was in Polish I wouldn't have a problem :)[/color]

            :-)

            --
            M S Herfried K. Wagner
            M V P <URL:http://dotnet.mvps.org/>
            V B <URL:http://classicvb.org/petition/>

            Comment

            • Cor Ligthert

              #7
              Re: Daten aus einer Website einlesen

              Crouchie,

              bez problem

              zum erstellen einer Anfrag an eine Website benutze ich folgenden Code:
              To fulfil a request from a website do I need the next code

              'Website zu der die Anfrage gestelt werden soll
              Website where the request will be done

              Das scheint auch zu funktionieren, doch wie kann ich die Daten die mir die
              Website zurückliefert z.B. in ein String einlesen?

              Thas seems as welll to funcion, however how can I get the data that the
              Website returns read into a String.


              Cor


              Comment

              • Cor Ligthert

                #8
                Re: Daten aus einer Website einlesen

                Herfried,

                You make me curious where did you assume that download, it has something to
                do with to get a request using post.

                However I see code I don't understand. When I had written this by instance
                (with what it was) than I had directly gotten an question fom you from which
                language it is. (It is not used in the code by the way)

                Dim encoding = New System.Text.UTF 8Encoding


                Cor


                Comment

                • Herfried K. Wagner [MVP]

                  #9
                  Re: Daten aus einer Website einlesen

                  "Cor Ligthert" <notmyfirstname @planet.nl> schrieb:[color=blue]
                  > You make me curious where did you assume that download, it has something
                  > to do with to get a request using post.[/color]

                  Well yes, I meant getting the data returned by the request...

                  --
                  M S Herfried K. Wagner
                  M V P <URL:http://dotnet.mvps.org/>
                  V B <URL:http://classicvb.org/petition/>

                  Comment

                  Working...