Completed

Read the Source Code of one URL using Proxy with VB 6.0

This project was successfully completed by nikhiltechnology for $30 USD in 3 days.

Get free quotes for a project like this
Project Budget
$10 - $30 USD
Completed In
3 days
Total Bids
5
Project Description

Hello freelancers, hope you will help to me to find a solution for this issue I have:

I'm using an app developed with Visual Basic 6.0 and try to get the Source Code of one URL using a function called "ReadURL()".

That function is working fine without proxy uses, but now, I have to use proxies for that andI can't find the solution for that. I've tried modifying the code below, filling with proxies and ports, but that doesn't work.

If you can correct that and find the better solution for this issue I'll award you instantly. just show me the solution is working.

Below you will see the code I'm using for that app:

Public Declare Function InternetOpen Lib "[url removed, login to view]" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long

Public Declare Function InternetOpenUrl Lib "[url removed, login to view]" Alias "InternetOpenUrlA" (ByVal hInternetSession As Long, ByVal sURL As String, ByVal sHeaders As String, ByVal lHeadersLength As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long

Public Declare Function InternetReadFile Lib "[url removed, login to view]" (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer

Public Declare Function InternetCloseHandle Lib "[url removed, login to view]" (ByVal hInet As Long) As Integer

Public Const IF_NO_CACHE_WRITE = &H4000000

Public Const BUFFER_LEN = 256

Public Function ReadURL(sURL As String) As String

Dim sBuffer As String * BUFFER_LEN, iResult As Integer, sData As String

Dim hInternet As Long, hSession As Long, lReturn As Long

'get the handle of the current internet connection

hSession = InternetOpen("vb wininet", 1, vbNullString, vbNullString, 0)

'get the handle of the url

If hSession Then

hInternet = InternetOpenUrl(hSession, sURL, vbNullString, 0, IF_NO_CACHE_WRITE, 0)

End If

'if we have the handle, then start reading the web page

If hInternet Then

'get the first chunk & buffer it.

iResult = InternetReadFile(hInternet, sBuffer, BUFFER_LEN, lReturn)

sData = sBuffer

'if there’s more data then keep reading it into the buffer

Do While lReturn <> 0

iResult = InternetReadFile(hInternet, sBuffer, BUFFER_LEN, lReturn)

sData = sData + Mid(sBuffer, 1, lReturn)

Loop

End If

'close the URL

iResult = InternetCloseHandle(hInternet)

LeeURL = sData 'here is the source code of the URL readed and is what I need using PROXY

'A sample of a proxy I have to use is: IP ADDRESS: [url removed, login to view] and PORT ADDRESS: 54221

'(is just a sample, that proxy is not working. To try you may use a free proxy you can find over there)

'End of source code...

Thanks freelancers and good luck with this.

Regards.

Completed by:

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online