Read the Source Code of one URL using Proxy with VB 6.0
$10-30 USD
Dibayar saat pengiriman
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.
ID Proyek: #5197562
Tentang proyek
Diberikan kepada:
Hello, I am vb6.0 expert I can provide proper solution to fetch the HTML code for the URL I can start this project immediately. Regards Nikhil
5 freelancer rata-rata menawar $33 untuk pekerjaan ini
Hi. In the past I developed vb6 app that use WinInet API for reading sites via proxy. Can remake your code to achieve this goal. Regards, Yuri
Dear Sir, I am a Professional Programmer since 2008, I have many programs developed and successfully finished in my past employer, I am expert in IT Industry both Hardware and Software Programming, I will give you t Lebih banyak