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.

VB.Net HTTP Wrapper by Kitsune.

1.9k views · started by Kitsune ·
#1
VB.Net HTTP Wrapper by Kitsune.
Hello I am new to Logical Gamers, and i wanted to share my basic VB.Net HttpWrapper.
I'm a newbie coder and have been attempting Gaiaonline's login, haven't succeeded yet but im still giving it a try.

Anyway here is my wrapper class: TinyUpload.com - best file hosting solution, with no limits, totaly free

May need Imports:
Imports System.IO, System.Net


Usage Example:
Dim Wrapper As New Wrapper()
dim html as string
'(HTML AS RESPONSE, URL, METHOD, POSTdata, Refferer)
Wrapper.Webrequest(html, "Http://www.blah.com", POST, "data+data+data", "")
Wrapper.Webrequest(html, "Http://www.blah.com", GET, "", "")


Let me know if there is anything you want me to add or have any suggestions.
#2
Looks alright if you're new :) If you need help with anything (i.e. login), feel free to ask. We're a pretty friendly and helpful bunch :)
#3
I hope you aren't the Kitsune i think you are
#4
I hope you aren't the Kitsune i think you are

Referring to Kitsune/Flame?
#5
Yeah, don't think it's Izaya/Flame.

Apologies for derailing your thread, OP.
#6
No, im not anyone else.
Figures some one else would use Kitsune ><
Also, @Artificial i'm looking at Stapled's C# gaia login, but it's hard for me to understand and if i try to add an if-else i get some error in visual studio that says "Unreachable code".
#7
Post your code. It sounds like you're creating (possible a set of) conditions that will never evaluate to true.
#8

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
class Program
{
public static Boolean GaiaLogin(string username, string password)
{
HttpInterface wrapper = new HttpInterface();
Console.WriteLine("Logging");
string pd = StringExtensions.gsb((wrapper.get("http://www.gaiaonline.com/")), "</fieldset>", "</form>").Replace("data-value", "");
List<string> n = StringExtensions.gasb(pd, "name=\"", "\"");
List<string> v = StringExtensions.gasb(pd, "value=\"", "\"");
string postdata = n[0] + "=" + v[0]
+ "&" + n[1] + "=" + v[1]
+ "&" + n[2] + "=" + v[2]
+ "&" + n[3] + "=" + v[3]
+ "&" + "username=" + username + "&password=" + password;
string login = wrapper.post("http://www.gaiaonline.com/auth/login/", postdata);
login = wrapper.get("http://www.gaiaonline.com/");
return login.Contains("Welcome back");
<--------- Want to Add Something here, but i get error as described before --------->

}
static void Main(string[] args)
{
GaiaLogin("******", "******"); <----- Account Details

}
}
}

[/3][/3][/2][/2][/1][/1][/0][/0]


I kinda wanna write something like this:

if (login.Contains("Welcome back"))
{
Console.WriteLine("Pass");
}
else
Console.WriteLine("Fail");
}
#9
Put if (login.Contains("Welcome back")) { Console.WriteLine("Pass"); } else Console.WriteLine("Fail"); }

or whatever your code is before the return login.Contains("welcome back")

Return also signifies the end of a function or procedure. At least in most languages. See if something like that works. If not I'm probably overlooking another error in your code.
#10
Ah! Thank you for that information, i got it to work; however i have a lot of C# learning i need to do before i can compile a decent program but i suppose i'm one step closer.
I wish i could effectively convert everything into VB.NET (including chad's String Extensions) but i end up getting tons of errors i cant fix.
#11
There aren't really significant differences in VB.NET and C# syntactically. Both are powered by the underlying .NET Framework.

So porting the code shouldn't be too hard if you can read basic code and know a bit about the .NET libraries.

Anyway, if you need any help feel free to ask here and I'm sure someone will assist you.
#12
I'll post a vb.net login with wrappers and all that good stuff in the next few days.