Starting an action

Discussion in 'Code Snippets and Tutorials' started by Fexxel, Mar 18, 2009.

  1. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    Alright, I'm kinda trying to learn fast so I'm going to type this post as quickly as possible.
    How do I have a button that carries out an action. For example: I am trying to make a "start" button to begin going through sponsor links. So, heres a small portion of the code I have:
    Code (Text):
    1. dim w as new tcpwrapper
    2. dim strhtml as string = w.getrequest(http://www.neopets.com/process_click.phtml?item_id=7781&noredirect=1, http://www.neopets.com/index.phtml)
    What I'm trying to do is for it to visit that link by pushing "start". And then, after that, I have a list of links for it to visit. Is there a way I can get it so that when someone pushes the "start" button it visits all of those links with a 4 second delay? Anyways, just telling me how to create a submit button is fine.
    Oh, and I don't want it to seem like I'm asking random questions. If anyone here knows a good forum for VB.net help, please do PM me. :)
    Thanks,
    Fexxel
     
  2. tharoux

    tharoux Level IV

    Joined:
    Dec 30, 2006
    Messages:
    2,733
    Likes Received:
    126
    Location:
    In front of my PC, Montreal
    first, put a new command button on your form. Double-click it to open the code. VB will automaticaly put all it needs to run what you want. Now, you don't need to declare the wrapper everytime. Just one time is fine. So the declaration won't be in any of the sub or function. You put it right before that (but still, in the main class).

    Now, I'll just explain a thing to you that may help.
    dim strhtml as string = w.getrequest("http://www.neopets.com/process_click.phtml?item_id=7781&noredirect=1", "http://www.neopets.com/index.phtml")

    In this line, you're declaring a variable containing strings and putting in it the result of the getrequest.
    For the sponsor, you don't need to see the result. The only time you want to see the result is if you need to extract some information from it. So this line is useless here. You can skip it. If you wish to keep it, do it but refer to first part of the post about variable declaration.

    So, for what you want to do, you can simply put in the code for your command button something like
    Code (Text):
    1.  
    2. w.getrequest("http://www.neopets.com/process_click.phtml?item_id=7781&noredirect=1", "http://www.neopets.com/index.phtml")
    3. w.pause(4)
    4. w.getrequest("http://www.neopets.com/process_click.phtml?item_id=7781&noredirect=1", "http://www.neopets.com/index.phtml")
    5. w.pause(4)
    6. w.getrequest("http://www.neopets.com/process_click.phtml?item_id=468", "http://www.neopets.com/index.phtml")
    7. w.pause(4)
    8. w.getrequest("http://www.neopets.com/process_click.phtml?item_id=772", "http://www.neopets.com/index.phtml")
    9. w.pause(4)
    10. ...
    and so on
     
  3. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    Code (Text):
    1. Error   2   Syntax error.   C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  54  43  Sponsor Doer
    2. Error   3   Syntax error.   C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  54  81  Sponsor Doer
    3. Error   5   'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  56  9   Sponsor Doer
    4. Error   7   'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  58  9   Sponsor Doer
    5. Error   9   'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  60  9   Sponsor Doer
    6. Error   11  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  62  9   Sponsor Doer
    7. Error   4   'getrequest' is not a member of 'NeoLogin___Updated.TCPWrapper'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  55  9   Sponsor Doer
    8. Error   6   'getrequest' is not a member of 'NeoLogin___Updated.TCPWrapper'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  57  9   Sponsor Doer
    9. Error   8   'getrequest' is not a member of 'NeoLogin___Updated.TCPWrapper'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  59  9   Sponsor Doer
    10. Error   10  'getrequest' is not a member of 'NeoLogin___Updated.TCPWrapper'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  61  9   Sponsor Doer
    11. Error   1   ')' expected.   C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  54  41  Sponsor Doer
    12.  
    I wanted to test the lines of code you gave me to make sure I was putting everything in the right place. Thats what happened.
    Also, if I'm trying to log the amount of NP someone has after going to a sponsor, should I then use the refer http://www.neopets.com/index.phtml?
    Finally, I don't really understand what you mean by how to make a button. I double clicked on a blank part of form1 and it opened up code, but it didn't create a button. I was wondering how to name a button and how to name the actual window? (I started with your login then expanded, but now it says NeoLogin)
     
  4. tharoux

    tharoux Level IV

    Joined:
    Dec 30, 2006
    Messages:
    2,733
    Likes Received:
    126
    Location:
    In front of my PC, Montreal
    Looks like you tried to paste my code into your project. just open neologin-updated.sln.
    This code is working. For the button, there's a panel on the left with all the kind of thing you can use.

    dumb Q: did you installed vb ??
     
  5. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    1. Thanks, I figured out the button thing just now.
    2. Yes, I have installed VB. I have VB express.
    ----
    Now I have a new problem. I don't know how to read these errors:
    Code (Text):
    1. Error   1   ')' expected.   C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  54  41  Sponsor Doer
    2. Error   2   Syntax error.   C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  54  43  Sponsor Doer
    3. Error   3   Syntax error.   C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  54  81  Sponsor Doer
    4. Error   4   'getrequest' is not a member of 'NeoLogin___Updated.TCPWrapper'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  55  9   Sponsor Doer
    5. Error   5   'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  56  9   Sponsor Doer
    6. Error   6   'getrequest' is not a member of 'NeoLogin___Updated.TCPWrapper'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  57  9   Sponsor Doer
    7. Error   7   'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  58  9   Sponsor Doer
    8. Error   8   'getrequest' is not a member of 'NeoLogin___Updated.TCPWrapper'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  59  9   Sponsor Doer
    9. Error   9   'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  60  9   Sponsor Doer
    10. Error   10  'getrequest' is not a member of 'NeoLogin___Updated.TCPWrapper'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  61  9   Sponsor Doer
    11. Error   11  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  62  9   Sponsor Doer
    12. Error   12  ')' expected.   C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  67  41  Sponsor Doer
    13. Error   13  Syntax error.   C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  67  43  Sponsor Doer
    14. Error   14  Syntax error.   C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  67  81  Sponsor Doer
    15. Error   15  'getrequest' is not a member of 'NeoLogin___Updated.TCPWrapper'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  68  9   Sponsor Doer
    16. Error   16  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  69  9   Sponsor Doer
    17. Error   17  'getrequest' is not a member of 'NeoLogin___Updated.TCPWrapper'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  70  9   Sponsor Doer
    18. Error   18  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  71  9   Sponsor Doer
    19. Error   19  'getrequest' is not a member of 'NeoLogin___Updated.TCPWrapper'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  72  9   Sponsor Doer
    20. Error   20  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  73  9   Sponsor Doer
    21. Error   21  'getrequest' is not a member of 'NeoLogin___Updated.TCPWrapper'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  74  9   Sponsor Doer
    22. Error   22  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  75  9   Sponsor Doer
    23.  
    This is what I was trying to do:
    Code (Text):
    1. Public Sub fmrNeoLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         Dim w As New TCPWrapper
    3. Dim strhtml As String = w.getrequest(http://www.neopets.com/objects.phtml, http://www.neopets.com/index.phtml)
    4.         w.getrequest("http://www.neopets.com/process_click.phtml?item_id=7781&noredirect=1", "http://www.neopets.com/index.phtml")
    5.         w.pause(4)
    6.         w.getrequest("http://www.neopets.com/process_click.phtml?item_id=7781&noredirect=1", "http://www.neopets.com/index.phtml")
    7.         w.pause(4)
    8.         w.getrequest("http://www.neopets.com/process_click.phtml?item_id=468", "http://www.neopets.com/index.phtml")
    9.         w.pause(4)
    10.         w.getrequest("http://www.neopets.com/process_click.phtml?item_id=772", "http://www.neopets.com/index.phtml")
    11.         w.pause(4)
    12.     End Sub
    Just to see if I could get it to work, and then I'd replace the Urls. I was trying to get that to be the code for my "Start" button.
    Heres what my project works like right now:
    (Check attachments)
     
  6. tharoux

    tharoux Level IV

    Joined:
    Dec 30, 2006
    Messages:
    2,733
    Likes Received:
    126
    Location:
    In front of my PC, Montreal
    mystical wrapper is not using getrequest....
    it should be w.request("GET",url, referer)
     
  7. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    So...
    It should be this:
    Code (Text):
    1. Public Sub fmrNeoLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         Dim w As New TCPWrapper
    3. Dim strhtml As String = w.getrequest(http://www.neopets.com/objects.phtml, http://www.neopets.com/index.phtml)
    4.         w.getrequest("GET" "http://www.neopets.com/process_click.phtml?item_id=7781&noredirect=1", "http://www.neopets.com/index.phtml")
    5.         w.pause(4)
    6.         w.getrequest("GET" "http://www.neopets.com/process_click.phtml?item_id=7781&noredirect=1", "http://www.neopets.com/index.phtml")
    7.         w.pause(4)
    8.         w.getrequest("GET" "http://www.neopets.com/process_click.phtml?item_id=468", "http://www.neopets.com/index.phtml")
    9.         w.pause(4)
    10.         w.getrequest("GET" "http://www.neopets.com/process_click.phtml?item_id=772", "http://www.neopets.com/index.phtml")
    11.         w.pause(4)
    12.     End Sub
    13.  
    ?
    Oh, by the way, check attachment for what I have so far ^^
     
  8. tharoux

    tharoux Level IV

    Joined:
    Dec 30, 2006
    Messages:
    2,733
    Likes Received:
    126
    Location:
    In front of my PC, Montreal
    Almost... the thing is that you shouldn't do this on form_load.
    This mean that as soon as the program is open, it will run this.
    Instead, put it on the button code (double click your "Pwnage" button and paste it there.)
    Second, you need to be logged in into neopets first. In the wrapper, you have a neologin function. Use it like this

    strhtml = w.neologin(username, password, false)

    After that, you can validate that you're logged in by checking the code in strhtml.

    See the solution I gave you for all the information. BTW, I'm using "response" instead of "strhtml" so don't be confuse.
     
  9. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    1. So I should put down
    Code (Text):
    1. strhtml = w.neologin(username, password, false)
    before I type in the code?
    Because I just started, and I got 70 errors...
    These are the errors I got:
    Code (Text):
    1. Error   1   'lblStatus' is not a member of 'NeoLogin___Updated.fmrNeoLogin'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  58  9   Sponsor Doer
    2. Error   2   Name 'txtNFUser' is not declared.   C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  60  107 Sponsor Doer
    3. Error   3   Name 'txtNFPass' is not declared.   C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  60  139 Sponsor Doer
    4. Error   4   'lblStatus' is not a member of 'NeoLogin___Updated.fmrNeoLogin'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  74  13  Sponsor Doer
    5. Error   5   'lblStatus' is not a member of 'NeoLogin___Updated.fmrNeoLogin'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  76  17  Sponsor Doer
    6. Error   6   'lblStatus' is not a member of 'NeoLogin___Updated.fmrNeoLogin'.    C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  82  13  Sponsor Doer
    7. Error   7   ')' expected.   C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  90  41  Sponsor Doer
    8. Error   8   Syntax error.   C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  90  43  Sponsor Doer
    9. Error   9   Syntax error.   C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  90  81  Sponsor Doer
    10. Error   10  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  91  9   Sponsor Doer
    11. Error   11  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  93  9   Sponsor Doer
    12. Error   12  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  95  9   Sponsor Doer
    13. Error   13  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  97  9   Sponsor Doer
    14. Error   14  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  99  9   Sponsor Doer
    15. Error   15  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  100 9   Sponsor Doer
    16. Error   16  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  101 9   Sponsor Doer
    17. Error   17  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  102 9   Sponsor Doer
    18. Error   18  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  103 9   Sponsor Doer
    19. Error   19  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  104 9   Sponsor Doer
    20. Error   20  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  105 9   Sponsor Doer
    21. Error   21  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  106 9   Sponsor Doer
    22. Error   22  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  107 9   Sponsor Doer
    23. Error   23  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  108 9   Sponsor Doer
    24. Error   24  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  109 9   Sponsor Doer
    25. Error   25  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  110 9   Sponsor Doer
    26. Error   26  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  111 9   Sponsor Doer
    27. Error   27  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  112 9   Sponsor Doer
    28. Error   28  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  113 9   Sponsor Doer
    29. Error   29  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  114 9   Sponsor Doer
    30. Error   30  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  115 9   Sponsor Doer
    31. Error   31  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  116 9   Sponsor Doer
    32. Error   32  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  117 9   Sponsor Doer
    33. Error   33  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  118 9   Sponsor Doer
    34. Error   34  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  119 9   Sponsor Doer
    35. Error   35  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  120 9   Sponsor Doer
    36. Error   36  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  121 9   Sponsor Doer
    37. Error   37  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  122 9   Sponsor Doer
    38. Error   38  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  123 9   Sponsor Doer
    39. Error   39  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  124 9   Sponsor Doer
    40. Error   40  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  125 9   Sponsor Doer
    41. Error   41  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  126 9   Sponsor Doer
    42. Error   42  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  127 9   Sponsor Doer
    43. Error   43  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  128 9   Sponsor Doer
    44. Error   44  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  129 9   Sponsor Doer
    45. Error   45  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  130 9   Sponsor Doer
    46. Error   46  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  131 9   Sponsor Doer
    47. Error   47  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  132 9   Sponsor Doer
    48. Error   48  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  133 9   Sponsor Doer
    49. Error   49  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  134 9   Sponsor Doer
    50. Error   50  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  135 9   Sponsor Doer
    51. Error   51  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  136 9   Sponsor Doer
    52. Error   52  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  137 9   Sponsor Doer
    53. Error   53  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  138 9   Sponsor Doer
    54. Error   54  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  139 9   Sponsor Doer
    55. Error   55  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  140 9   Sponsor Doer
    56. Error   56  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  141 9   Sponsor Doer
    57. Error   57  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  142 9   Sponsor Doer
    58. Error   58  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  143 9   Sponsor Doer
    59. Error   59  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  144 9   Sponsor Doer
    60. Error   60  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  145 9   Sponsor Doer
    61. Error   61  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  146 9   Sponsor Doer
    62. Error   62  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  147 9   Sponsor Doer
    63. Error   63  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  148 9   Sponsor Doer
    64. Error   64  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  149 9   Sponsor Doer
    65. Error   65  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  150 9   Sponsor Doer
    66. Error   66  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  151 9   Sponsor Doer
    67. Error   67  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  152 9   Sponsor Doer
    68. Error   68  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  153 9   Sponsor Doer
    69. Error   69  Argument not specified for parameter 'Referer' of 'Public Function Request(Method As String, URL As String, Referer As String) As String'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  154 9   Sponsor Doer
    70. Error   70  'NeoLogin___Updated.TCPWrapper.Private Shared Sub Pause(seconds As Double)' is not accessible in this context because it is 'Private'.  C:\Users\Carter\Desktop\NeoLogin - Updated\NeoLogin - Updated\Form1.vb  155 9   Sponsor Doer
    71.  
    Heres the full code I have:
    Code (Text):
    1. Imports System.Text.RegularExpressions
    2. Imports System.Net
    3. Imports System.IO
    4. Imports System.Text
    5. Imports System.IO.Compression
    6. Imports System.Runtime.Serialization.Formatters.Binary
    7.  
    8. Public Class fmrNeoLogin
    9.     Private Wrapper As New TCPWrapper
    10.     Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
    11.         cmdLogin.Enabled = False
    12.         txtUser.Enabled = False
    13.         txtPass.Enabled = False
    14.         If txtUser.Text = "" Or txtPass.Text = "" Then
    15.             MsgBox("Username and/or password cannot be blank")
    16.             cmdLogin.Enabled = True
    17.             txtUser.Enabled = True
    18.             txtPass.Enabled = True
    19.         Else
    20.             lstLog.Items.Add("Logging in...")
    21.             lstLog.SelectedIndex = lstLog.Items.Count - 1
    22.             Application.DoEvents()
    23.             Dim Response = Wrapper.NeoLogin(txtUser.Text, txtPass.Text, False)
    24.             Application.DoEvents()
    25.             If Response = "Logged In" Then
    26.                 lstLog.Items.Add("Logged in as " + txtUser.Text)
    27.                 cmdLogout.Enabled = True
    28.                 lstLog.SelectedIndex = lstLog.Items.Count - 1
    29.             Else
    30.                 lstLog.Items.Add(Response)
    31.                 MsgBox("There was a problem logging in. See log for details")
    32.                 cmdLogin.Enabled = True
    33.                 txtUser.Enabled = True
    34.                 txtPass.Enabled = True
    35.                 lstLog.SelectedIndex = lstLog.Items.Count - 1
    36.             End If
    37.         End If
    38.     End Sub
    39.  
    40.     Private Sub cmdLogout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogout.Click
    41.         Wrapper.ClearCookies()
    42.         cmdLogin.Enabled = True
    43.         cmdLogout.Enabled = False
    44.         lstLog.Items.Add("Logged Out")
    45.         txtUser.Text = ""
    46.         txtPass.Text = ""
    47.         txtUser.Enabled = True
    48.         txtPass.Enabled = True
    49.         lstLog.SelectedIndex = lstLog.Items.Count - 1
    50.     End Sub
    51.  
    52.     Public Sub fmrNeoLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    53.  
    54.         Dim bAuth As Boolean = False
    55.         Dim bNewVersion As Boolean = False
    56.         Dim ProgID As Integer = 222 'change to your program download id
    57.         Dim ProgName As String = "Your Program Name v1.x" 'must be exactly the same as in the nf download section
    58.         Me.lblStatus.Text = "Checking Authorization..."
    59.         'this auth uses mysticals wrapper, posted in the code snippets forum
    60.         Dim strReturn As String = Wrapper.Request("GET", "http://www.neofriends.net/auth.php?username=" & txtNFUser.Text & "&password=" & txtNFPass.Text & "&program=" & ProgID, "http://www.neofriends.net/")
    61.  
    62.         If strReturn.Contains("Not Authorized to use the program") Then
    63.             bAuth = False
    64.         ElseIf strReturn.Contains("Authorized to use the program") Then
    65.             bAuth = True
    66.             If strReturn.Contains(ProgName) <> True Then
    67.                 bNewVersion = True
    68.             End If
    69.         Else
    70.             bAuth = False 'some unknown error if we end up here
    71.         End If
    72.  
    73.         If bAuth = True Then
    74.             Me.lblStatus.Text = "Authorized!"
    75.             If bNewVersion = True Then 'as long as you have the version as part of the progName, this check will work
    76.                 Me.lblStatus.Text = "New Version"
    77.                 MsgBox("Authorized! However it appears a new version of this program is now available. Please download the latest version!", MsgBoxStyle.Exclamation, "www.neofriends.net")
    78.                 Exit Sub 'you can remove this if you wish to let the user use the program even though it is not the latest version
    79.             End If
    80.             'enable your controls here, now that the user is authorized
    81.         Else
    82.             Me.lblStatus.Text = "Failed Authorization"
    83.             MsgBox("You are not authorized to use this program.", MsgBoxStyle.Exclamation, "www.neofriends.net")
    84.         End If
    85.  
    86.     End Sub
    87.  
    88.     Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    89.         Dim w As New TCPWrapper
    90. Dim strhtml As String = w.getrequest(http://www.neopets.com/objects.phtml, http://www.neopets.com/index.phtml)
    91.         w.Request("get", "http://www.neopets.com/neostatus.phtml?item_id=4532&multiple=1&status=11&nc_value=3&noredirect=1")
    92.         w.Request("GET", "http://www.neopets.com/neostatus.phtml?item_id=4543&multiple=1&status=11&nc_value=3&noredirect=1", "http://www.neopets.com/index.phtml")
    93.         w.pause(4)
    94.         w.Request("GET", "http://www.neopets.com/neostatus.phtml?item_id=4543&multiple=1&status=11&nc_value=3&noredirect=1", "http://www.neopets.com/index.phtml")
    95.         w.pause(4)
    96.         w.Request("GET", "http://www.neopets.com/neostatus.phtml?item_id=5426&multiple=1&status=11&nc_value=3&noredirect=1", "http://www.neopets.com/index.phtml")
    97.         w.pause(4)
    98.         w.Request("GET", "http://www.neopets.com/neostatus.phtml?item_id=5446&multiple=1&status=11&nc_value=3&noredirect=1", "http://www.neopets.com/index.phtml")
    99.         w.pause(4)
    100.         w.Request("get", "http://www.neopets.com/neostatus.phtml?item_id=5652&status=11&nc_value=3&noredirect=1")
    101.         w.pause(4)
    102.         w.Request("get", "http://www.neopets.com/neostatus.phtml?item_id=5904&multiple=1&status=11&nc_value=3&noredirect=1")
    103.         w.pause(4)
    104.         w.Request("get", "http://www.neopets.com/neostatus.phtml?item_id=6104&multiple=1&status=11&nc_value=3&noredirect=1")
    105.         w.pause(3)
    106.         w.Request("get", "http://www.neopets.com/neostatus.phtml?item_id=6610&status=11&nc_value=3&noredirect=1")
    107.         w.pause(4)
    108.         w.Request("get", "http://www.neopets.com/neostatus.phtml?item_id=7192&multiple=1&status=11&nc_value=3&noredirect=1")
    109.         w.pause(4)
    110.         w.Request("get", "http://www.neopets.com/neostatus.phtml?item_id=7428&multiple=1&status=11&nc_value=3&noredirect=1")
    111.         w.pause(3)
    112.         w.Request("get", "http://www.neopets.com/neostatus.phtml?item_id=8063&multiple=1&status=11&nc_value=3&noredirect=1")
    113.         w.pause(4)
    114.         w.Request("get", "http://www.neopets.com/neostatus.phtml?item_id=8370&multiple=1&status=11&nc_value=3&noredirect=1")
    115.         w.pause(3)
    116.         w.Request("get", "http://www.neopets.com/neostatus.phtml?item_id=9087&multiple=1&status=11&nc_value=3&noredirect=1")
    117.         w.pause(4)
    118.         w.Request("get", "http://www.neopets.com/neostatus.phtml?item_id=9087&multiple=1&status=11&nc_value=3&noredirect=1")
    119.         w.pause(4)
    120.         w.Request("get", "http://www.neopets.com/neostatus.phtml?item_id=8438&multiple=1&status=11&nc_value=3&noredirect=1")
    121.         w.pause(4)
    122.         w.Request("get", "http://www.neopets.com/neostatus.phtml?item_id=8438&multiple=1&status=11&nc_value=3&noredirect=1")
    123.         w.pause(3)
    124.         w.Request("get", "http://www.neopets.com/neostatus.phtml?item_id=8438&multiple=1&status=11&nc_value=3&noredirect=1")
    125.         w.pause(4)
    126.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=8980&noredirect=1")
    127.         w.pause(3)
    128.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=8980&noredirect=1")
    129.         w.pause(4)
    130.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=8980&noredirect=1")
    131.         w.pause(3)
    132.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=12097&r=49")
    133.         w.pause(2)
    134.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=12097&r=49")
    135.         w.pause(3)
    136.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=12097&r=49")
    137.         w.pause(4)
    138.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=1963&type_id=12&noredirect=1")
    139.         w.pause(3)
    140.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=2792&noredirect=1")
    141.         w.pause(4)
    142.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=2793&noredirect=1")
    143.         w.pause(4)
    144.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=3184&noredirect=1")
    145.         w.pause(3)
    146.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=4451&noredirect=1&r=49")
    147.         w.pause(4)
    148.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=4474&noredirect=1")
    149.         w.pause(4)
    150.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=4492&noredirect=1")
    151.         w.pause(4)
    152.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=4493&noredirect=1")
    153.         w.pause(3)
    154.         w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=4600&noredirect=1")
    155.         w.pause(3)
    156.     End Sub
    157.  
    158.     Private Sub lstLog_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstLog.SelectedIndexChanged
    159.  
    160.     End Sub
    161.  
    162.     Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
    163.  
    164.     End Sub
    165.  
    166.  
    167.  
    168.  
    169.     Private Sub Progress_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Progress.Click
    170.  
    171.     End Sub
    172. End Class
    173.  
    174. Public Class TCPWrapper
    175.     Inherits System.Windows.Forms.UserControl
    176. #Region " Windows Form Designer generated code "
    177.     Public Sub New()
    178.         MyBase.New()
    179.         'This call is required by the Windows Form Designer.
    180.         InitializeComponent()
    181.         'Add any initialization after the InitializeComponent() call
    182.     End Sub
    183.     'UserControl overrides dispose to clean up the component list.
    184.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    185.         If disposing Then
    186.             If Not (components Is Nothing) Then
    187.                 components.Dispose()
    188.             End If
    189.         End If
    190.         MyBase.Dispose(disposing)
    191.     End Sub
    192.     'Required by the Windows Form Designer
    193.     Private components As System.ComponentModel.IContainer
    194.     'NOTE: The following procedure is required by the Windows Form Designer
    195.     'It can be modified using the Windows Form Designer.
    196.     'Do not modify it using the code editor.
    197.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    198.         components = New System.ComponentModel.Container
    199.     End Sub
    200. #End Region
    201.     Private colCookies As New Collection
    202.     Dim strCookies As String
    203.     Public LastPage As String
    204.     Public Function Request(ByVal Method As String, ByVal URL As String, ByVal Referer As String) As String
    205.         Dim Host As String = Nothing
    206.         Dim strFile As String = Nothing
    207.         Dim strPost As String = Nothing
    208.         Dim pos As Integer = 0
    209.         If Referer Is Nothing Then
    210.             Referer = LastPage
    211.         End If
    212.         If URL.Contains("http://") Then
    213.             Host = URL.Substring(7)
    214.         Else
    215.             Host = URL
    216.         End If
    217.         If Host.Contains("/") Then
    218.             pos = Host.IndexOf("/", 0)
    219.             strFile = Host.Substring(pos)
    220.             Host = Host.Substring(0, pos)
    221.         Else
    222.             strFile = "/"
    223.         End If
    224.         If Method = "POST" Then
    225.             pos = strFile.IndexOf("?")
    226.             If Not (pos = -1) Then
    227.                 strPost = strFile.Substring(pos + 1)
    228.                 strFile = strFile.Substring(0, pos)
    229.             Else
    230.                 strPost = Nothing
    231.             End If
    232.         End If
    233.         If Method = "POST2" Then
    234.             pos = strFile.IndexOf("?")
    235.             If Not (pos = -1) Then
    236.                 strPost = strFile.Substring(pos + 1)
    237.                 strFile = strFile.Substring(0, pos)
    238.             Else
    239.                 strPost = ""
    240.             End If
    241.         End If
    242.         LastPage = URL
    243.         Dim ReqHeaders As String = Nothing
    244.         If Method = "GET" OrElse Method = "PIC" Then
    245.             ReqHeaders = "GET" + " " + strFile + " HTTP/1.1" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Host: " + Host + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Language: en-us,en;q=0.5" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Encoding: gzip, deflate" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Keep-Alive: 300" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Connection: keep-alive" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Referer: " + Referer + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Cookie: " + strCookies + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & ""
    246.         Else
    247.             ReqHeaders = "POST " + strFile + " HTTP/1.1" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Host: " + Host + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Language: en-us,en;q=0.5" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Encoding: gzip, deflate" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Keep-Alive: 300" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Connection: keep-alive" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Referer: " + Referer + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Cookie: " + strCookies + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Content-Type: application/x-www-form-urlencoded" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Content-Length: " + strPost.Length.ToString + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Connection: close" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + strPost
    248.         End If
    249.         If Method = "PIC" Then
    250.             ReqHeaders.Replace("Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5", "Accept: image/png,*/*;q=0.5")
    251.         End If
    252.  
    253.         Dim tcp As New System.Net.Sockets.TcpClient
    254.         Dim netstream As System.Net.Sockets.NetworkStream
    255.         Dim TN(1) As Long
    256.         If Referer = "" Then Referer = LastPage
    257.         If InStr(1, URL, "http://") <> 0 Then Host = Mid$(URL, 8)
    258.         If InStr(1, Host, "/") <> 0 Then Host = Mid$(Host, 1, InStr(1, Host, "/") - 1)
    259.         If InStr(1, Host, "?") <> 0 Then Host = Mid$(Host, 1, InStr(1, Host, "?") - 1)
    260.         LastPage = URL
    261.         Try
    262.             tcp.Connect(Host, 80)
    263.         Catch ex As Exception
    264.             Return ex.Message
    265.         End Try
    266.  
    267.         Dim sendbytes As Byte()
    268.         sendbytes = System.Text.Encoding.ASCII.GetBytes(ReqHeaders)
    269.         netstream = tcp.GetStream()
    270.         netstream.Write(sendbytes, 0, sendbytes.Length)
    271.         Dim sr As StreamReader = New StreamReader(netstream, Encoding.Default)
    272.         Dim strHTML As String = sr.ReadToEnd
    273.         Dim strParts As String() = Regex.Split(strHTML, Environment.NewLine + Environment.NewLine)
    274.         strCookies = ParseCookies(strParts(0))
    275.         If strParts(0).Contains("Content-Encoding") Then
    276.             strParts(1) = DecompressGzip(strParts(1))
    277.         End If
    278.  
    279.         Return strParts(0) + Environment.NewLine + Environment.NewLine + strParts(1)
    280.     End Function
    281.     Public Function DecompressGzip(ByVal compressed As String) As String
    282.         Dim memStream As MemoryStream = New MemoryStream(System.Text.Encoding.Default.GetBytes(compressed))
    283.         Dim decompressStream As GZipStream = New GZipStream(memStream, CompressionMode.Decompress)
    284.         Dim endBytes(4) As Byte
    285.         Dim position As Integer = CType(memStream.Length, Integer) - 4
    286.         memStream.Position = position
    287.         memStream.Read(endBytes, 0, 4)
    288.         memStream.Position = 0
    289.         Dim buffer(BitConverter.ToInt32(endBytes, 0) + 100) As Byte
    290.         Dim offset As Integer = 0
    291.         Dim total As Integer = 0
    292.         While True
    293.             Dim bytesRead As Integer = decompressStream.Read(buffer, offset, 100)
    294.             If bytesRead = 0 Then
    295.                 Exit While
    296.             End If
    297.             offset += bytesRead
    298.             total += bytesRead
    299.         End While
    300.         Return Encoding.ASCII.GetString(buffer)
    301.     End Function
    302.     Public Function ParseCookies(ByVal Headers As String) As String
    303.         ParseCookies = ""
    304.         Dim reg As Regex
    305.         Dim matches As MatchCollection
    306.         Dim match As Match
    307.         reg = New Regex("set-cookie:\s*([^=]+)=([^;]+);", RegexOptions.IgnoreCase)
    308.         If reg.IsMatch(Headers) Then
    309.             matches = reg.Matches(Headers)
    310.             For Each match In matches
    311.                 Try
    312.                     colCookies.Add(match.Groups(1).ToString & "=" & match.Groups(2).ToString, match.Groups(1).ToString)
    313.                 Catch ex As Exception
    314.                     colCookies.Remove(match.Groups(1).ToString)
    315.                     colCookies.Add(match.Groups(1).ToString & "=" & match.Groups(2).ToString, match.Groups(1).ToString)
    316.                 End Try
    317.             Next
    318.         End If
    319.         Dim i As Long
    320.         For i = 1 To colCookies.Count Step 1
    321.             ParseCookies = ParseCookies & colCookies.Item(i).ToString & ";"
    322.         Next
    323.     End Function
    324.     Public Function StripHeaders(ByVal strSource As String) As String
    325.         Dim strParts() As String = Regex.Split(strSource, Environment.NewLine + Environment.NewLine)
    326.         Return strParts(1)
    327.     End Function
    328.     Public Function NeoLogin(ByVal user As String, ByVal pass As String, ByRef loggedIn As Boolean) As String
    329.         Dim strHTML As String = Nothing
    330.         Request("GET", "http://www.neopets.com/loginpage.phtml", "http://www.google.com")
    331.         Pause(1)
    332.         Request("POST", "http://www.neopets.com/hi.phtml?destination=%2Findex.phtml&username=" + user, "http://www.neopets.com/loginpage.phtml")
    333.         Pause(1)
    334.         strHTML = Request("POST", "http://www.neopets.com/login.phtml?username=" + user + "&password=" + pass + "&destination=%2Findex.phtml", "http://www.neopets.com/hi.phtml")
    335.         If strHTML.Contains("Set-Cookie: neologin=") Then
    336.             loggedIn = True
    337.             Return "Logged In"
    338.         Else
    339.             If strHTML.Contains("too many times") Then
    340.                 loggedIn = False
    341.                 Return "To Many Login Attempts"
    342.             Else
    343.                 If strHTML.Contains("badpassword") Then
    344.                     loggedIn = False
    345.                     Return "Wrong Username/Password"
    346.                 Else
    347.                     If strHTML.Contains("frozen") Then
    348.                         loggedIn = False
    349.                         Return "Account Frozen"
    350.                     Else
    351.                         If strHTML.Contains("just a technical problem") Then
    352.                             loggedIn = False
    353.                             Return "Neopets is down for maintenance"
    354.                         Else
    355.                             loggedIn = False
    356.                             Return "Unknow Error"
    357.                         End If
    358.                     End If
    359.                 End If
    360.             End If
    361.         End If
    362.     End Function
    363.     Private Shared Sub Pause(ByVal seconds As Double)
    364.         Dim num As Double = seconds * 1000
    365.         Dim t1 As DateTime = DateTime.Now
    366.         Dim t2 As DateTime = DateTime.Now
    367.         Dim tmDiff As TimeSpan = t2 - t1
    368.         While Convert.ToDouble(tmDiff.TotalMilliseconds.ToString) < num
    369.             t2 = DateTime.Now
    370.             tmDiff = t2 - t1
    371.             Application.DoEvents()
    372.         End While
    373.     End Sub
    374.     Public Function GrabPic(ByVal strURL As String) As System.Drawing.Image
    375.         Dim memStream As New MemoryStream(System.Text.Encoding.Default.GetBytes(StripHeaders(Request("GET", strURL, LastPage))))
    376.         GrabPic = Image.FromStream(memStream)
    377.         Return GrabPic
    378.     End Function
    379.     Public Sub ClearCookies()
    380.         colCookies.Clear()
    381.         strCookies = Nothing
    382.     End Sub
    383.     Public Function GetBetween(ByVal Source As String, ByVal Start As String, ByVal Finish As String) As String
    384.         Dim Result = ""
    385.         Dim A = InStr(1, Source, Start) + Len(Start)
    386.         If A = 0 Then
    387.             Result = ""
    388.             Return Result
    389.         Else
    390.             Dim B = InStr(A, Source, Finish)
    391.             If B = 0 Then
    392.                 Result = ""
    393.                 Return Result
    394.             Else
    395.                 Result = Mid(Source, A, B - A)
    396.                 Return Result
    397.             End If
    398.         End If
    399.     End Function
    400.     Public Function GetRefCk(ByVal Source As String) As String
    401.         Dim StringPosition = InStr(Source, "_ref_ck")
    402.         Source = Source.Remove(0, StringPosition)
    403.         StringPosition = InStr(Source, "value")
    404.         Source = Source.Remove(0, StringPosition + 6)
    405.         StringPosition = InStr(Source, ">")
    406.         Source = Source.Remove(StringPosition - 2, Source.Length - (StringPosition - 2))
    407.         Return Source
    408.     End Function
    409. End Class
    410.  
    I don't get it lol.
    The url I put down (the request thing) shows up as underlined in red. It says that it's messed up (shows up in error console)
    What is the exact model for the url thing? This is what I am using:
    Code (Text):
    1. w.Request("get", "http://www.neopets.com/process_click.phtml?item_id=1963&type_id=12&noredirect=1")
    2.         w.pause(3)
    So...
    w.request("get", "http://urlhere", "refer (not needed for my program since I'm not logging amount of NP)")
    (on a new line) w.pause (number of seconds here)
    Because it's just not working lol.
     
  10. tharoux

    tharoux Level IV

    Joined:
    Dec 30, 2006
    Messages:
    2,733
    Likes Received:
    126
    Location:
    In front of my PC, Montreal
    if you don't mind, zip the entire folder containing your code (I swear, I won't steal anything :lol:) and pm it to me...
    It's hard debugging something when we can't see the form. Some errors seems to be related to unproperly named items. I'll make the correction and put comments where I did the changes and why.

    On another note... when doing a request (get or post), you need to put "GET", URL, REFERER and the REFERER part is very important.
    To insure you're not cheating, TNT looks at the referer and if the referer is wrong or missing, you might end up with a 404 error.
    Referer as nothing to do with the fact that you want to check the code after. It NEEDS to be there. What you will analyse is the strhtml part in strhtml = w.request("GET",url,referer). That's why it's in red. It's missing something.
     
  11. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    Billy told me that the referer wasn't needed. :-/ Billy!! :'(
    Alright, I'll zip it up right now.
     
  12. tharoux

    tharoux Level IV

    Joined:
    Dec 30, 2006
    Messages:
    2,733
    Likes Received:
    126
    Location:
    In front of my PC, Montreal
    sometime, you can skip it and the code is suppose to fill it for you but it's not working and I'm too lazy to fix this. Futhermore, I prefer to manage them myself.
     
  13. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
  14. tharoux

    tharoux Level IV

    Joined:
    Dec 30, 2006
    Messages:
    2,733
    Likes Received:
    126
    Location:
    In front of my PC, Montreal
    remove the ? at the end...
    I don't know what is the referer but I know that someone wrote a guide for firefox and he putted the right referer in it.
    In fact, if you don't use the right referer, you won't get any nps
     
  15. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    The ? was for the question if that was the correct refer. I will go check the forums right now for the firefox guide.
    EDIT: I just went through every firefox guide on NF. Couldn't find the correct refer.
     
  16. tharoux

    tharoux Level IV

    Joined:
    Dec 30, 2006
    Messages:
    2,733
    Likes Received:
    126
    Location:
    In front of my PC, Montreal
    LOL... my bad...
    I'll try to find the guide.
     
  17. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    I couldn't find it :'(
    Good luck lol.
    I think I'll try to stay in 1 topic so...
    ----
    for the progress bar .value = xxx what goes before the "."? w? (w is the variable I assigned to the wrapper) And also, if I have over 100 links, can I use decimals? for example:
    Code (Text):
    1. (what ever goes here).value = .5
    ?
     
  18. tharoux

    tharoux Level IV

    Joined:
    Dec 30, 2006
    Messages:
    2,733
    Likes Received:
    126
    Location:
    In front of my PC, Montreal
    I don't think so...
    just go past 2 links and than add +1 ;)
     
  19. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    Thats too bad :'(
    Sweet! All I needa do is figure out the errors and finish adding the sponsor links! PWNAGE!