A preserved archive of the Logical Gamers community forums, 2009-2025. The original threads and posts, served read-only. Registration, posting and private messages are gone for good.

Friend Delete program

1.5k views · started by ~Shieru No Tamashi~ ·
#1
Friend Delete program
As Christian requested, I am trying to make a friend deleter for Gaia, and that's what I put in VB.NET:

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("www.gaiaonline.com")
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.Navigate("www.gaiaonline.com/friends")
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim HTMLcode, HTMLcode1 As String
HTMLcode = WebBrowser1.DocumentText
HTMLcode1 = HTMLcode.Replace("flag;", "true;")
HTMLcode1 = HTMLcode.Replace("Remove Friend", "True")
RichTextBox1.Text = HTMLcode1
End Sub


End Class


I was wondering how I could load the HTMLcode1 (where values are replaced) in the current WebBrowser, and if there is another way to do it.
#2
What do I add.
Buttons,
Textboxes,
webbrowser?
And where do i place the code?
#3
Christian wrote:
What do I add.
Buttons,
Textboxes,
webbrowser?
And where do i place the code?



You misunderstood, i guess. I posted the code to be corrected, it hasn't been compiled yet. If I get the appropriate help, I will send it to you.
#4
Probably the programming section would have better help.
I'm not sure of the properties of a Web browser, however you might want to use HTTP Wrappers in order to send requests to the server. That way you can just send a POST request with the proper parameters to delete a friend.

Sorry if you didn't understand this.
#5
Start taking advantage of invokemember. It'll be way simpler.

    private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (webBrowser1.Url.ToString() == "www.gaiaonline.com/friends") {
webBrowser1.Document.GetElementById("select_all_checkbox").InvokeMember("Click");
webBrowser1.Document.GetElementById("removefriend").InvokeMember("Click");
label1.Text = "Done";
}
}
#6
Riddle wrote:
Probably the programming section would have better help.
I'm not sure of the properties of a Web browser, however you might want to use HTTP Wrappers in order to send requests to the server. That way you can just send a POST request with the proper parameters to delete a friend.

Sorry if you didn't understand this.



That's what I am hardly trying to learn during those two past months, how to make use of HTTP wrappers, in vain.

@Thomas: Thank you for the answer, here's my new code:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
For i As Integer = 0 To NumberOfFriendPages.Text
If WebBrowser1.Url.ToString() = "www.gaiaonline.com/friends" Then
WebBrowser1.Document.GetElementById("select_all_checkbox").InvokeMember("click")
WebBrowser1.Document.GetElementById("removefriend").InvokeMember("click")
MessageBox.Show("Done")
End If
WebBrowser1.Refresh()
Next
End Sub


But do the InvokeMember function change the HTML original code or does it affect the current page?
#7
That's what I am hardly trying to learn during those two past months, how to make use of HTTP wrappers, in vain.

@Thomas: Thank you for the answer, here's my new code:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
For i As Integer = 0 To NumberOfFriendPages.Text
If WebBrowser1.Url.ToString() = "www.gaiaonline.com/friends" Then
WebBrowser1.Document.GetElementById("select_all_checkbox").InvokeMember("click")
WebBrowser1.Document.GetElementById("removefriend").InvokeMember("click")
MessageBox.Show("Done")
End If
WebBrowser1.Refresh()
Next
End Sub


But do the InvokeMember function change the HTML original code or does it affect the current page?


It just effects the current page. There is no need to alter the html code.
#8
You guys need to stop using the Web Browsers. Use HTTP Wrappers.
#9
Chad wrote:
You guys need to stop using the Web Browsers. Use HTTP Wrappers.


Could you give me an example of a function that does this job?
#10
Example in C#.

    public static Boolean Remove_Friend(int UserID)
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorAddFriend + UserID + "/", "action=Remove Friend&user_ids[]=" + UserID, Gaia_URL_Nor + Gaia_URL_NorAddFriend + UserID + "/").IndexOf("Success") > -1)
{
return true;
}
return false;
}
#11
i could try putting it together in a window? if whoever wanted it wanted me too ive got nothing better to do atm :1