Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6
Go Back  Xtreme Visual Basic Talk > > > Adapt VB.NET proxy code o VB6


Reply
 
Thread Tools Display Modes
  #1  
Old 10-19-2011, 09:22 AM
whistller whistller is offline
Newcomer
 
Join Date: Oct 2011
Posts: 6
Default Adapt VB.NET proxy code o VB6


I want You to ask for a help. how to adapt this VB.NET code to Visual Basic 6 ?
Code:
Imports System.Collections.Generic
Imports System.IO
Imports System.Net

Namespace blogtest
Class Program
Private Shared Sub Main(args As String())
Dim http As New simplehttp()
‘testing on ipcheckit.com so we can make sure we’re really connecting through proxy. Look for proxy IP in html printed in console
‘remember to change 127.0.0.1, 8080, login, password to your working proxy details
Dim html As String = http.geturl(”http://ipcheckit.com/”, “127.0.0.1″, 8080, “login”, “password”)
System.Console.WriteLine(html)
End Sub
End Class

Class simplehttp
Public Function geturl(url As String, proxyip As String, port As Integer, proxylogin As String, proxypassword As String) As String
Dim resp As HttpWebResponse
Dim req As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
req.UserAgent = “Mozilla/5.0″
req.AllowAutoRedirect = True
req.ReadWriteTimeout = 5000
req.CookieContainer = New CookieContainer()
req.Referer = “”
req.Headers.[Set](”Accept-Language”, “en,en-us”)
Dim stream_in As StreamReader

Dim proxy As New WebProxy(proxyip, port)
‘if proxylogin is an empty string then don’t use proxy credentials (open proxy)
If proxylogin “” Then
proxy.Credentials = New NetworkCredential(proxylogin, proxypassword)
End If
req.Proxy = proxy

Dim response As String = “”
Try
resp = DirectCast(req.GetResponse(), HttpWebResponse)
stream_in = New StreamReader(resp.GetResponseStream())
response = stream_in.ReadToEnd()
stream_in.Close()
Catch ex As Exception
End Try
Return response
End Function

Public Function getposturl(url As String, postdata As String, proxyip As String, port As Short, proxylogin As String, proxypassword As String) As String
Dim resp As HttpWebResponse
Dim req As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
req.UserAgent = “Mozilla/5.0″
req.AllowAutoRedirect = True
req.ReadWriteTimeout = 5000
req.CookieContainer = New CookieContainer()
req.Method = “POST”
req.ContentType = “application/x-www-form-urlencoded”
req.ContentLength = postdata.Length
req.Referer = “”

Dim proxy As New WebProxy(proxyip, port)
‘if proxylogin is an empty string then don’t use proxy credentials (open proxy)
If proxylogin “” Then
proxy.Credentials = New NetworkCredential(proxylogin, proxypassword)
End If
req.Proxy = proxy

Dim stream_out As New StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII)
stream_out.Write(postdata)
stream_out.Close()
Dim response As String = “”

Try
resp = DirectCast(req.GetResponse(), HttpWebResponse)
Dim resStream As Stream = resp.GetResponseStream()
Dim stream_in As New StreamReader(req.GetResponse().GetResponseStream())
response = stream_in.ReadToEnd()
stream_in.Close()
Catch ex As Exception
End Try
Return response
End Function
End Class
End Namespace
Help
Reply With Quote
  #2  
Old 10-20-2011, 01:49 AM
Flyguy's Avatar
FlyguyAdapt VB.NET proxy code o VB6 Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 19,160
Default

What's the code supposed to do?
Reply With Quote
Reply


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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6 Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6
 
Adapt VB.NET proxy code o VB6
Adapt VB.NET proxy code o VB6
 
-->