1 Attachment(s)
How can fix errot about get html source with this special https url
hi,i am trying for get hrml source of my special url "https://www.melkeirani.com/melk-225433".
my problem is about work on windows 7 and lower versions.
i attached my source and i need help to can fix it.
i designed 6 buttons for get source html with 6 different methods
my result on different windows are :
on windows 10 64bit :
button 2,button 3,button 5,button 6 worked
button 1 error : A connection with the server could not be established
on windows xp :
button 6 worked.
button 1,4 error : A connection with the server could not be established
button 2,3,5 error : The download of then specified resouce had failed.
on windows 7 64 bit :
button 6 worked.
button 1,4 error : A connection with the server could not be established
button 2,3,5 error : The download of then specified resouce had failed.
button 6 worked on all version windows and i used chilkat for button 6.
i searched in google about that errors and i find too many answered about use tls versions or install easy fix from microsoft and etc and i did try for fix errors but not solved yet.
i found other samples about downloaders or https connect but not worked on that windows 7 yet and same errors.
my important question is about button 6,if my windows hv problem or need special refrences or install some servicices packs or etc ... why button 6 worked on all .
i want jst one sample code to get source html to work on windows 7 and that my spcial url sample too.
button 1 source code :
Code:
Dim ht As New WinHttpRequest
ht.open "GET", "https://www.melkeirani.com/melk-225433", False
ht.Option(WinHttpRequestOption_SslErrorIgnoreFlags) = SslErrorFlag_Ignore_All
ht.Option(WinHttpRequestOption_SecureProtocols) = WinHttpRequestSecureProtocols.SecureProtocol_ALL
ht.setRequestHeader "Accept-Charset", "utf-8"
ht.setRequestHeader "Accept-encoding", "utf-8"
ht.setRequestHeader "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"
ht.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
ht.send
ht.WaitForResponse
MsgBox ht.responseText
Set ht = Nothing
button 2:
Code:
Dim http As New MSXML2.XMLHTTP60
Dim url As String
url = "https://www.melkeirani.com/melk-225433"
http.open "Get", url, False
http.send
MsgBox http.responseText
button 3:
Code:
DownloadFile "https://www.melkeirani.com/melk-225433", App.Path & "\3.html"
button 4 :
Code:
Dim objHTTP As Object
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
Dim url As String
url = "https://www.melkeirani.com/melk-225433"
objHTTP.open "GET", url, False
objHTTP.Option(WinHttpRequestOption_SecureProtocols) = WinHttpRequestSecureProtocols.SecureProtocol_ALL
objHTTP.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
objHTTP.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHTTP.send
MsgBox objHTTP.responseText
button 5 :
Code:
Dim fso As Object
Dim ShApp As Object
Dim WshShell As Object
Dim File As Object
Dim BS As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("Wscript.Shell")
Set ShApp = CreateObject("Shell.Application")
On Error Resume Next
Set File = CreateObject("Microsoft.XMLHTTP")
File.open "GET", "https://www.melkeirani.com/melk-225433", False
File.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C; .NET4.0E; BCD2000; BCD2000)"
File.send
If Err.Number <> 0 Then
MsgBox "Error " & Err.Number & "(0x" & Hex(Err.Number) & ") " & Err.Description
MsgBox "Source " & Err.Source
MsgBox ""
MsgBox "HTTP Error " & File.Status & " " & File.statusText
MsgBox File.getAllResponseHeaders
Else
On Error GoTo 0
Set BS = CreateObject("ADODB.Stream")
BS.Type = 1
BS.open
BS.Write File.responseBody
BS.SaveToFile ShApp.Namespace(&H10).self.Path & "\5.html", 2
End If
button 6 : (sample chilkat)
Code:
Dim req As New ChilkatHttpRequest
Dim http As New ChilkatHttp
Dim success As Long
' need acitve key replace with "..."
'success = http.UnlockComponent("...")
If (success <> 1) Then
MsgBox http.LastErrorText
Exit Sub
End If
Dim localFilePath As String
localFilePath = App.Path & "\6.html"
success = http.Download("https://www.melkeirani.com/melk-225433", localFilePath)
If (success <> 1) Then
MsgBox "error : " & http.LastErrorText
Exit Sub
End If
Re: How can fix errot about get html source with this special https url
not answer yet?!!! i am wait for long time yet here.
Re: How can fix errot about get html source with this special https url
probably most are dependent on the version of internet explorer that is with the version of windows
Re: How can fix errot about get html source with this special https url
Libcurl uses most of its own code independent of
underlying os or ie version.
It is free and open source. I would use that
https://github.com/dzzie/libs/tree/master/vbLibCurl
Re: How can fix errot about get html source with this special https url
Quote:
Originally Posted by
westconn1
probably most are dependent on the version of internet explorer that is with the version of windows
if problem is about ie version so why when i use chilkat thats work,how can write a simple program to can work like as chilkat,how possible other ways not worked with that ie version but chilkat worked?!!!!
Re: How can fix errot about get html source with this special https url
Quote:
Originally Posted by
dz32
i will be download it and test it too but i want know why button 6 worked on all windows with all version ie?!!!
if depends to ie version why when i use chilkat its work on all my tested windows and different ie version?
how can write a program to get that url source, i cant fix my problem yet lower than windows 10
am i should be use external dll like as chilkat for fix that problem? any sample?
and i asked a sepcial question here about how use cas firefox for open urls
any way to use CAs(Certificate Authorities Firefox) when want get source of ssl urls?
Re: How can fix errot about get html source with this special https url
if it was easy chikat would not have developed their software as noone would buy
Re: How can fix errot about get html source with this special https url
chilkat dll is 10.5mb and only imports from ws2_32 low level winsock api which is the most stable and least to change between windows versions. I think they said they did not use openssl but I cant imagine they recreated it. maybe they used another library internally but looks like least dependency on windows os version. the libcurl comes with 4 dlls at 4mb total.
I mean you could write your own 10.5mb of code to do what it does if you dont want to use an external library.
https://m.youtube.com/watch?v=pFfJ5WA0SC4
Re: How can fix errot about get html source with this special https url
Quote:
Originally Posted by
westconn1
if it was easy chikat would not have developed their software as noone would buy
but i asked this thread because of it to can find a good way like as chilkat to know how do that.
Re: How can fix errot about get html source with this special https url
i can fix my problem like as i said in thread No 1 with chilkat but i dont want use external refrensess like as chilkat and payment, i keep open this thread maybe i can find better way
and can u explain to me about which refrencess need to use with Libcurl
am i need all these files in same folder for install too? and r u sure these file works on win xp,win 7,win 10 and 32bit and 64 bits?
because i said in thread no 1 chilkat worked with all my tested os versions but i dont know yet these files worked too?
libcrypto-1_1.dll
libcurl.dll
libCurlActX.dll
libssl-1_1.dll
vblibcurl.dll
curl.exe
curl-ca-bundle.crt
i want publish my project but which these files is not useful
Re: How can fix errot about get html source with this special https url
At a minimum you would need to include
Libcrypto-1_1.dll
libcurl.dll
libssl-1_1.dll
vblibcurl.dll
curl-ca-bundle.crt
None of these dlls need to be registered as they are Written in c. Just need to be in your exe home directory.
libCurlActX.dll is an activex dll that would need to be registered With regsvr32.exe from a 32bit process such as a cmd console Running as admin.
This last dll is optional. Since it is open source and written in vb You can just include it’s source in your main project directly and Skip the dll. The dll just makes it easier to reuse the code from Multiple projects assuming you are comfortable knowing how to Register it properly.
Yes I have tested libcutl in all os from xp sp3 and up
If this sounds like to much then I would recommend just using the chilkat control with comes with an easy installer, documentation and commercial support.
I can not really Offer much more help
Re: How can fix errot about get html source with this special https url
its k i will be check it and i created this thread and u know why,because i wanted make a simple program for get source of my https url without error about tls or etc... on xp till win 10 windows but without need payment for use special dlls like as chilkat(when i want use chilkat i jst copy or register it jst 1 file no more and i dont need install it with installers or etc ,i tested on win xp sp2 and higher till win 10 64bit its work good ,but chilkat is so power full because of summary classes to work more than jst network so is better than others dlls) but i still i want find a way without need payment for use dlls and i cant payment from my country too because of limitation pay from other countries currency so its so hard to i want pay.
i created some threads about this problem but about other ideas too but i still i am wait to find better way. and if this libcurl worked i will be go to next step because i hv another problem after this problem about how login first and get session or coockies after login to site to can access my url source,because if i can get https source of url but its need use special coockie or session first ,i will be explain later if i can goto step 2.
can u jst send a sample jst with important dlls and simple source without other extra codes for jst get source of my this url "https://www.melkeirani.com/melk-225433"
and can send a sample about use libcurl for login to site and then get coockie or session after login because i want know how do that with libcurl project ,thanks
Re: How can fix errot about get html source with this special https url
Quote:
Originally Posted by
Black_Storm
but without need payment for use special dlls
Well .Net is free. I'm pretty sure .Net had all this stuff built for a very long time and it's possible to use it in VB6 through COM interop. You might have to use an older version though since you want to support XP and you'd still have to "install and register stuff". I can't guarantee that this path with work for you, but it's the only one you haven't tried.
Re: How can fix errot about get html source with this special https url
Other than .Net, you could consider shelling out from within the VB6 application to things like node.js or a CPython script. I'm sure both these environments have very powerful HTTP libraries too.
Re: How can fix errot about get html source with this special https url
Quote:
Originally Posted by
Niya
Well .Net is free. I'm pretty sure .Net had all this stuff built for a very long time and it's possible to use it in VB6 through COM interop. You might have to use an older version though since you want to support XP and you'd still have to "install and register stuff". I can't guarantee that this path with work for you, but it's the only one you haven't tried.
Quote:
Originally Posted by
Niya
Other than .Net, you could consider shelling out from within the VB6 application to things like node.js or a CPython script. I'm sure both these environments have very powerful HTTP libraries too.
can send some sample in vb6 and special that url to i sent?