Go Back   Gaming Gutter > Non-Gaming > Programming > Source Code


Source Code - Have a source code/project files you want to post? Do so here.

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

Password:

Not a member yet?
Register Now!
» Advertisement
» Recent Threads
Go to first new post The best browser
11-13-2008 06:35 PM
Last post by azn fingers
Today 08:54 PM
59 Replies, 353 Views
Go to first new post Selling Tons of Legit...
07-17-2008 06:47 PM
by Crim
Last post by ebilbish
Today 08:51 PM
432 Replies, 4,744 Views
Go to first new post What's your weather?
11-08-2008 04:43 PM
by reirei
Last post by azn fingers
Today 08:51 PM
58 Replies, 355 Views
Go to first new post Instruments, anyone?
10-23-2008 11:50 AM
Last post by azn fingers
Today 08:49 PM
131 Replies, 728 Views
Go to first new post Heather wants to kill a...
Today 06:49 PM
Last post by Unregenerate Passion
Today 08:48 PM
19 Replies, 72 Views
Reply
 
LinkBack Thread Tools Display Modes

 [VB6] Set Static Addresses for HTTWrapper
Old 06-22-2008, 08:00 PM   #1 (permalink)
Banned

Male Carnage is offline
 
Join Date: Sep 2006
Location: Saco, Maine
Age: 18
Posts: 1,879
GPoints: 379
iTrader: 1 / 100%
Carnage Is Popular
Rep Power: 0
[VB6] Set Static Addresses for HTTWrapper

Basically, this allows you to send HTTP Requests without having to type the IP and Port at the end of your request.

Add this to the bottom of your HTTPWrapper control:

Code:
Public Function GetProxyWrapper(URL As String, Optional Referer As String = "") As String

Dim TempRef As String
Dim HostX As String
Dim Tempfile As String
Dim FileX As String

    If Referer <> "" Then
        TempRef = "Referer: " & Referer & vbCrLf
    Else
        TempRef = ""
    End If
    
    Call WaitForWinSockClose

    If LCase$(Left$(URL, 7)) = "http://" Then
        Tempfile = Mid$(URL, 8)
    Else
        Tempfile = URL
    End If
    
        FileX = URL

    If Winsock1.State <> 0 Then
        Winsock1.Close
        Call WaitForWinSockClose
    End If
    
    Winsock1.RemoteHost = HostP
    Winsock1.RemotePort = PortP
    Winsock1.LocalPort = 0
    
    If Not StopIT And Winsock1.State <> 7 Then
        Winsock1.Connect
    End If
    
    Call WaitForWinSockConnect

    If Not StopIT Then
        Winsock1.SendData GETPage(FileX, HostP, TempRef)
    End If

    Call WaitForWinSockClose

    LastPage = URL
    If LCase$(Left$(URL, 7)) <> "http://" Then
        LastPage = "http://" & LastPage
    End If

    If DontParseHttp Then
        GetProxyWrapper = strKomplett
    Else
        GetProxyWrapper = HTTParse(strKomplett)
    End If

End Function

Public Function PostProxyWrapper(URL As String, Datastring As String) As String

Dim TempRef As String
Dim HostX As String
Dim Tempfile As String
Dim FileX As String

    If Referer <> "" Then
        TempRef = "Referer: " & Referer & vbCrLf
    Else
        TempRef = ""
    End If
    
    If LCase$(Left$(URL, 7)) = "http://" Then
        Tempfile = Mid$(URL, 8)
    Else
        Tempfile = URL
    End If
        FileX = URL
    
    If Winsock1.State <> 0 Then
        Winsock1.Close
        Call WaitForWinSockClose
    End If
    
    Winsock1.RemoteHost = HostP
    Winsock1.RemotePort = PortP
    Winsock1.LocalPort = 0
    
    If Not StopIT And Winsock1.State <> 7 Then
        Winsock1.Connect
    End If
    
    Call WaitForWinSockConnect
    
    If Not StopIT Then
        Winsock1.SendData FormPOST(FileX, HostP, Datastring, TempRef)
    End If
    
    Call WaitForWinSockClose

    LastPage = URL
    If LCase$(Left$(URL, 7)) <> "http://" Then
        LastPage = "http://" & LastPage
    End If
    
    If DontParseHttp Then
        PostWrapper = strKomplett
    Else
        PostWrapper = HTTParse(strKomplett)
    End If
    
End Function

Public Function SetProxy(IP As String, Port As String) As String
Dim HostStore As String, PortStore As String
HostStore = Winsock1.LocalIP
PortStore = Winsock1.LocalPort
HostP = IP
PortP = Port
End Function

Public Function RemoveProxy()
Winsock1.RemoteHost = HostStore
Winsock1.RemotePort = PortStore
End Function
The commands are used as follows:

Set the IP and port for Winsock
Code:
strHTML = Wrapper.SetProxy(IP, Port)
Sets the remote address and port back to its normal settings
Code:
strHTML = Wrapper.RemoveProxy()
Go to the URL entered using the proxy settings
Code:
strHTML = Wrapper.GetProxyWrapper(URL, referrer)
Post at the URL using the proxy settings
Code:
strHTML = Wrapper.PostProxyWrapper(URL, dataToPost, referrer)
I wrote this because it was annoying for me to sit there and type in the IP and Port every time I wanted to send an HTTP request.
  Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -7. The time now is 08:59 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.08522606 seconds (100.00% PHP - 0% MySQL) with 19 queries