Consulting

Results 1 to 2 of 2

Thread: Get the max value from a web page

  1. #1

    Get the max value from a web page

    i need to get the max value from the button...

    for year 2000 the max value is 3
    for year 1997 the max value is 2
    ...
    ecc...


    see imge

    actually i use this api:

    With WHTTP
    .setTimeouts 50000, 50000, 15000, 15000
    .Open "GET", "https://www.xamig.com/superenalotto/1997/estrazioni.php", Rnd, False
    .send
    Sleep (500)
    'Do Until html.ReadyState = 4
    'Loop
    html.body.innerHTML = .responseText
    End With
    Attached Images Attached Images
    Sal
    1 help 1 pizza
    2 help 1 pizza 1 caff?
    3 help 1 pizza 1 caff? 1 mozzarella
    ...
    Spaghetti, Lasagne and Tortellini for the "Lady" ;-)

  2. #2
    VBAX Mentor
    Joined
    Dec 2008
    Posts
    405
    Location
    Try it
    Sub GetPageCount()    
        Dim http As Object
        Dim html As Object
        Dim pageCount As Integer
        Dim i As Integer
        Dim url As String
        Dim matches As Object
        Dim regex As Object
        url = "https://www.xamig.com/superenalotto/2024/estrazioni.php"
        Set http = CreateObject("MSXML2.XMLHTTP")
        http.Open "GET", url, False
        http.Send
        Set html = CreateObject("htmlfile")
        html.body.innerHTML = http.responseText
        Set regex = CreateObject("VBScript.RegExp")
        With regex
            .Global = True
            .IgnoreCase = True
            .Pattern = "estrazioni\.php\?page=(\d+)"
        End With
        Set matches = regex.Execute(http.responseText)
        pageCount = 1
        For i = 0 To matches.Count - 1
            If CInt(matches(i).SubMatches(0)) > pageCount Then
                pageCount = CInt(matches(i).SubMatches(0))
            End If
        Next i
        MsgBox "Number of pages available: " & pageCount
    End Sub
    Artik

Posting Permissions

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