Go Back   Gaming Gutter


» Site Navigation
» Home
» FAQ
» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Advertisement
» Recent Threads
Go to first new post What do you do when your...
10-25-2008 12:23 AM
Last post by deadrckstr
Today 05:35 PM
116 Replies, 704 Views
Go to first new post Best current TV show
11-13-2008 10:07 AM
Last post by deadrckstr
Today 05:32 PM
15 Replies, 98 Views
Go to first new post Favorite Junkfood?
10-26-2008 01:36 PM
Last post by deadrckstr
Today 05:31 PM
133 Replies, 664 Views
Go to first new post Instruments, anyone?
10-23-2008 11:50 AM
Last post by deadrckstr
Today 05:30 PM
128 Replies, 705 Views
Go to first new post Selling aged shells or 3...
11-15-2008 02:00 PM
by jonsjon
Last post by jonsjon
Today 05:27 PM
3 Replies, 31 Views
View Single Post

 [vb6] Basics of HTTPwrapper
Old 03-19-2008, 09:44 PM   #1 (permalink)
second2none
Underground

Male second2none is offline
 
Join Date: Sep 2006
Location: BrisBANE <----
Age: 19
Posts: 5,025
GPoints: 315
iTrader: 1 / 100%
second2none Is a Party Captainsecond2none Is a Party Captainsecond2none Is a Party Captain
Rep Power: 16
[vb6] Basics of HTTPwrapper

NOTE: I have included my wrapper with this which has some added functions.
NOTE 2: Reading this tutorial is better once you know the basics of vb6. It wi8ll be a lot easier to understand.


[vb6] Basics of HTTPwrapper.

I see alot of people struggle when they come into internet programming in vb6, especially using pre-made wrappers.
HTTPwrapper.zip Contents:
-HTTPwrapper.ctl *
-Stuff.bas *
-Wait.Bas *
-Addon.Bas
(the ones with * are necessary to run HTTPwrapper)

What Is A Wrapper

A wrapper is a user control that uses microsoft winsock. It basically does all the work for you (connecting with winsock, headers, cookies), so in terms its a easier version of winsock.

Adding HTTPwrapper To A Project

When adding HTTPwrapper to Project be sure to add ALL of the files:
HTTPwrapper.ctl
Stuff.bas
Wait.bas
(Adding addon.bas is optional)
Tip: To add files quick in vb6. Press ctrl + D. and the Open Dialog box will appear.

Now your project should look like this.

Now in the side toolbar where you click to add your textboxes etc. You should see this icon.


Move your mouse over it, it should say, HTTPwrapper.

If not, and you have a disabled icon, its because your HTTPwrapper form is open. Just close it and you should be fine.

Once you have the HTTPwrapper added to the project, you need to add it to the form.
Click the ocn I showed you earlier, and add it to the form like you were adding a textbox.
Make it any size preferably small but so you can see the number.
Change the name of the wrapper in the properties box to something, alot of people use "w", I like to just use "wrapper", its easy to remember. Anyway.

Using The "GET" Method

Using the GET method with HTTPwrapper, is the same as if you type a URL in your internet browser. So if in your internet browser you wanted to visit google, the full url would be
"http://www.google.com/"

When using the GET method in HTTPwrapper, its essential you add the "/" at the end. (if you are added keys and values for a PHP file you don't add it to the end if them).

So now we know our URL we will write the code for vb6.
First.
Add 1 Command Button to your form and change the following properties:
Name: cmdGet
Text: Get URL

Double click the button and it should take you to the code screen, and in the button click event, type in.

HTML Code:
Dim strHTML as String
strHTML = wrapper.GetWrapper(URL, REFERRER[optional], PROXY[optional], PORT[optional])


That is the GetWrapper syntax. So now we just fill out our info.


HTML Code:
Dim strHTML as String
strHTML = wrapper.GetWrapper("http://www.google.com/")

Test Run the program and click the button, you will see the numbers go up, then down. That means it worked. So now that we have visited google.com what does strHTML hold?
Visit Google on your browser, once loaded, right click and view source. strHTML now holds all of that information / html / whatever code is there.
So basically we now hold google.com web page content. What can we do with that you might be asking, well.... we can use it to search for unique data to check if we are signed in, program updated, etc. You can also grab information like username., gold, posts etc.
String Search Example:
HTML Code:
Dim strHTML as String
strHTML = wrapper.GetWrapper("http://www.google.com/")
If Instr(1, strHTML, "logo.gif")
msgbox "Logo Is Present"
Else
msgbox "Logo Not Here"
End If
So here we just used the instr function (vb6 built in), so search our strHTML string for logo.gif, and if it was found then, it would msgbox "Logo is present" if not it would msgbox "Logo Not Here". THIS IS Very useful for checking if you are logged in or not.

String Grab Example: (Using Get String Between)
HTML Code:
Dim strHTML as String, strCountry as String
strHTML = wrapper.GetWrapper("http://www.google.com/")
strCountry = Addon.GetStringBetween(strHTML, " pages from ", " </label>")
msgbox strCountry
So using this example, we would grab what was ever between "pages from " and " </label>". In my case (since I live in aus) it would be a mgsbox containing "Australia".

If you need to use httpwrapper to send information to a PHP file, using the php GET function then you just add it like a normal url.
HTML Code:
Dim strHTML as String, strCountry as String
strHTML = wrapper.GetWrapper("http://www.google.com/index.php?message=HI")
Using HTTPwrapper To Send POSTDATA

Sending PostData is very handy when needing to make a login, or fill out a form etc.
So first we need to get the Post Data. Use a firefox addon called Live HTTP Headers.
(TO FIND OUT MORE IN POSTDATA GO HERE DarkZtar)

Once you have the post data its as simple as inputing it.
[html]
Dim strHTML as String
strHTML = wrapper.POSTWrapper(URL, POSTDATA, REFERRER[optional], PROXY[option], PORT[optional])

[/html

So now just insert your Post Data in. (I am using fake data)
HTML Code:
 Dim strHTML as String
 strHTML = wrapper.POSTWrapper("http://google.com/test.php", "fake=postdata&pwnt=ok")
Pretty simple, you can add Intr Checks and Grab Info the same way we did it in the GET method.

Note: Sometimes its required you add the correct referrer.

Things To Know

* If you make a login with the wrapper on form a, and have a new wrapper on form b, and try to call functions from a website that require you to be logged in, it won't work, you need to call them from the wrapper on form a. If that makes sense.

* You cannot connect to HTTPS, this is a HTTP wrapper only.

*Make sure you add ALL files to the project. HTTPwrapper is dependent on them.


DOWNLOAD FILES
RapidShare: 1-Click Webhosting


If you have an questions just ask.
If ther are any errors please tell me


Tutorial Written By Kane
Screenshots Taken By Kane
Wrapper By: Gluarks?

__________________
This is from:
Screenies Of A Mod
Code:
How did you do it? FLP , jotform, some other form of hacking? - First Class Noob
Lawl.. funny shit.

Quote:
Originally Posted by Kore
By k[ore] on Today, 08:44 AM
i'll give you rep alright, but it won't be positive.
Lawl Ownt

Hoes forgot to eat a dick and shut the FUCK UP!
  Reply With Quote
 
Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -7. The time now is 05:37 PM.


vBulletin skin developed by: eXtremepixels
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The contents of this webpage are copyright © 2006-2008 GamingGutter.com. All Rights Reserved.

Page generated in 0.07921600 seconds (100.00% PHP - 0% MySQL) with 18 queries