Results 1 to 12 of 12

Thread: [2008] httpwrapper help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    66

    [2008] httpwrapper help

    ok so i would like to have a key on my program
    i thought using httpwrapper to load a file from my site would be best cuz i chould change the key when i want but i dont know how to use httpwrapper fully any help?

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2008] httpwrapper help

    If you want to download a file from a website, that is pretty easy, just use the WebClient:

    Code:
            Dim wc As New System.Net.WebClient
            wc.DownloadFile("http://example.com/filename.txt", "C:\Temp\file.txt")
    Now using that for a key on your program can cause you headaches. What if the user doesn't have an internet connection when they start your app?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    66

    Re: [2008] httpwrapper help

    ok that works but now how would i make the code to read the file

    Code:
    if textbox1.text = (iunno this part) Then
    form2.show
    me.close
    EndIf
    if that how it would be?

  4. #4
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2008] httpwrapper help

    Code:
    textbox1.text = IO.File.ReadAllText("C:\Temp\file.txt")

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    66

    Re: [2008] httpwrapper help

    i get an error is it because my i uploaded it with an FTP thing?
    Attached Images Attached Images  

  6. #6
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2008] httpwrapper help

    Make sure you put the HTTP:// in front of your URL, also, check the response property of the exception to see why it failed.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    66

    Re: [2008] httpwrapper help


  8. #8
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2008] httpwrapper help

    Try something like this:

    Code:
            Dim wr As System.Net.HttpWebRequest = DirectCast(System.Net.HttpWebRequest.Create("http://www.evolutiongaming.co.cc/flp/key1.txt"), System.Net.HttpWebRequest)
            wr.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2"
            Dim res As System.Net.HttpWebResponse = DirectCast(wr.GetResponse(), System.Net.HttpWebResponse)
            Dim read(256) As Char
            Dim sr As New IO.StreamReader(res.GetResponseStream())
    
            sr.Read(read, 0, 256)
            TextBox1.Text = New String(read, 0, 256)

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    66

    Re: [2008] httpwrapper help

    kay so i think it works i got no errors but how will it open form2

  10. #10
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2008] httpwrapper help

    You need to build the code in to do that. So if you want to show form 2 after form 1 based on some condition, you will need to build the if statement and then declare an object as type Form2 and then show it.

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    66

    Re: [2008] httpwrapper help

    i have no how i would do that cuz iunno half the code u just gave me iunno what to do i have this
    vb Code:
    1. if textbox1.text = ?? o.o then
    2. form2.show
    3. me.close
    4. endif
    ehh i neve knew this would be that hard

  12. #12
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2008] httpwrapper help

    Code:
    If TextBox1.Text = New String(read, 0, 256) then

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width