Results 1 to 15 of 15

Thread: How can fix errot about get html source with this special https url

  1. #1

    Thread Starter
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    591

    Question 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
    Attached Files Attached Files

  2. #2

    Thread Starter
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    591

    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.

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,295

    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

  5. #5

    Thread Starter
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    591

    Re: How can fix errot about get html source with this special https url

    Quote Originally Posted by westconn1 View Post
    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?!!!!

  6. #6

    Thread Starter
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    591

    Re: How can fix errot about get html source with this special https url

    Quote Originally Posted by dz32 View Post
    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
    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?
    Last edited by Black_Storm; Jan 31st, 2022 at 02:55 AM.

  7. #7
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  8. #8
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,295

    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
    Last edited by dz32; Jan 31st, 2022 at 07:06 PM.

  9. #9

    Thread Starter
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    591

    Re: How can fix errot about get html source with this special https url

    Quote Originally Posted by westconn1 View Post
    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.

  10. #10

    Thread Starter
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    591

    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
    Last edited by Black_Storm; Feb 9th, 2022 at 03:42 AM.

  11. #11
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,295

    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
    Last edited by dz32; Feb 9th, 2022 at 06:41 AM.

  12. #12

    Thread Starter
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    591

    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
    Last edited by Black_Storm; Feb 12th, 2022 at 09:51 AM.

  13. #13
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: How can fix errot about get html source with this special https url

    Quote Originally Posted by Black_Storm View Post
    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.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  14. #14
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    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.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  15. #15

    Thread Starter
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    591

    Re: How can fix errot about get html source with this special https url

    Quote Originally Posted by Niya View Post
    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 View Post
    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?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width