XMLHTTP method

Bruzio

Board Regular
Joined
Aug 20, 2020
Messages
85
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
Hi to everybody, I'm using IE, but this method is slow so I want to change it to XLMHTTP.
I have tried but no output.

This is my IE code:

VBA Code:
Sub inplay()

    Dim IE As Object
    Dim item As Object
    Dim r As Integer
    Dim myurl As String

    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    
    Set IE = CreateObject("InternetExplorer.application")
    
    myurl = "https://www.nowgoal.pro/"
  
    With IE
        .navigate myurl
        .Visible = False
  
        Do While IE.Busy = True Or IE.readyState <> 4: DoEvents: Loop
  
    End With
    
    Application.Wait (Now + TimeValue("00:00:10"))

    r = 2

    For Each item In IE.document.getElementsByClassName("item")

        With Sheets("inplay")
            .Range("A" & r).Value = item.getElementsByClassName("gameName leaRow")(0).innerText
            .Range("B" & r).Value = Trim(item.getElementsByClassName("homeTeam").item(0).getElementsByTagName("span").item(0).innerText)
            .Range("C" & r).Value = Trim(item.getElementsByClassName("guestTeam").item(0).getElementsByTagName("span").item(0).innerText)
            'others
        End With

        r = r + 1

    Next item

    IE.Quit
    Set IE = Nothing
    
    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True

End Sub

Thanks a lot

Regards
 

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,268
Office Version
  1. 365
Platform
  1. Windows
Can you post the XMLHTTP code as well?
 

Bruzio

Board Regular
Joined
Aug 20, 2020
Messages
85
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
Can you post the XMLHTTP code as well?
Yes, excuse me

VBA Code:
Sub inplayxml()

    Dim item As Object
    Dim r As Integer
    Dim http As Object
    Dim html As HTMLDocument
   
       
    Set http = New MSXML2.XMLHTTP60
    Set html = New HTMLDocument
     
        http.Open "GET", "https://www.nowgoal.pro/", False
        http.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
        http.send
        html.body.innerHTML = http.responseText
       
        Application.Wait (Now + TimeValue("00:00:10"))
     
      r = 2

    For Each item In html.getElementsByClassName("item")

        With Sheets("inplay")
            .Range("A" & r).Value = item.getElementsByClassName("gameName leaRow")(0).innerText
            .Range("B" & r).Value = Trim(item.getElementsByClassName("homeTeam").item(0).getElementsByTagName("span").item(0).innerText)
            .Range("C" & r).Value = Trim(item.getElementsByClassName("guestTeam").item(0).getElementsByTagName("span").item(0).innerText)
            'others
        End With

        r = r + 1

    Next item
   
End Sub
 

Bruzio

Board Regular
Joined
Aug 20, 2020
Messages
85
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
Hi to everybody.

I tried with winhttp method too, but the result is no output. I haven't much experience with vba.

This is html code of the webpage:

HTML:
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en' >
<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="IE=edge, chrome=1">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <title>Nowgoal.pro-Mobi Livescore, Live Football Scores, results</title>
    <meta name="keywords" content="livescore, live scores, live football/ soccer" />
    <meta name="description" content="Nowgoal.pro Livescore offers football livescores, results, odds , standings, lineups and match details for 1500+ soccer leagues & cups." />
    <link rel="stylesheet" href="/Content/v1/fonts/iconfont.css">

        <link rel="canonical" href="https://www.nowgoal.pro/" />
    <link rel="apple-touch-icon-precomposed" href="/images/Ng/m-icon.png" />
    <meta property="og:image" content="/images/Ng/m-icon.png" />
    <meta name="twitter:card" content="summary_large_image" />
    <meta property="og:title" content="Nowgoal.pro-Mobi Livescore, Live Football Scores, results" />
    <meta property="og:description" content="Nowgoal.pro Livescore offers football livescores, results, odds , standings, lineups and match details for 1500+ soccer leagues & cups." />
    <meta property="og:type" content="website">

        <meta property="og:url" content="https://www.nowgoal.pro/">
    <link href="/Content/com/popup.less?v=637365345990000000" rel="stylesheet"/>
<link href="/Content/com/index.less?v=637469124550000000" rel="stylesheet"/>
<link href="/Content/v1/v1_index.less?v=637441593240000000" rel="stylesheet"/>
<link href="/Content/com/com.less?v=637473418300000000" rel="stylesheet"/>
<link href="/Content/v1/v1_com.less?v=637441593240000000" rel="stylesheet"/>
<link href="/Content/com/basket.less?v=637441593240000000" rel="stylesheet"/>
<link href="/Content/v1/v1_basket.less?v=637394164110000000" rel="stylesheet"/>
<link href="/Content/v1/ng/diff.less?v=637473418300000000" rel="stylesheet"/>

    <script type="text/javascript">
        var _locModel={};_locModel.T={T_HT:'HT',T_Ex_Min:'Min',T_Ex_Ot:'Ot',T_Ex_Pen:'Pen',T_Ex_TwoRounds:'Two Rounds',T_Ex_Win:'Win',T_MSG_FilteringNoMatches:'No record, please change the filter condiction.',T_MSG_NoMatchToday:'No Match Today',T_ISee:'I see',T_ReadMore:'Read More',T_Handicap:'Handicap',T_OverUnder:'Over/Under',T_NoOdds:'No Odds',T_SearchHot:'HOT',T_SearchCount:'{0} Record Found',T_S_HTScore:'HT',T_OK:'OK',T_Cancel:'Cancel',T_MSG_OnlyTwoOddsType:'Only two kinds of odds can be shown at one time!',T_Settings:'Settings',T_Sunday:'Sunday',T_Monday:'Monday',T_Tuesday:'Tuesday',T_Wednesday:'Wednesday',T_Thursday:'Thursday',T_Friday:'Friday',T_Saturday:'Saturday',T_January:'January',T_February:'February',T_March:'March',T_April:'April',T_May:'May',T_June:'June',T_July:'July',T_August:'August',T_September:'September',T_October:'October',T_November:'November',T_December:'December',T_Stat_S_Part1:'Part1',T_Stat_S_Part2:'Part2',T_Stat_S_Pen:'Pen',T_Stat_S_OverTime:'Ot',T_Stat_S_Cancel:'Cancel',T_Stat_S_Pending:'Pend.',T_Stat_S_Abd:'Abd',T_Stat_S_Pause:'Pause',T_Stat_Postp:'Postp.',T_Stat_FT:'FT',T_Stat_S_ToBeStart:'',T_Stat_ToBeStart:'Upcoming'};
         var _appModule = 'ng';
    </script>
    <script src="/scripts/locModelUtil.js?v=637351738790000000"></script>
<script src="/scripts/common/BomHelper.js?v=637441593270000000"></script>
<script src="/scripts/common/popup.js?v=637426681170000000"></script>
<script src="/scripts/ng/comDiff.js?v=637477897590000000"></script>

    <script src="/scripts/jquery.min.js?v=637351738790000000"></script>

   
    <script src="/scripts/common/v1/pushNote.js?v=637426681170000000"></script>


    <link rel="alternate" hreflang="en" href="http://www.nowgoal.pro" />
<script async src="https://www.googletagmanager.com/gtag/js?id=GTM-M4VBLJP"></script>
</head>
<body id="Football">
   

    <div id="container">
       
       

<div id="fHead">
    <div id="pushMsg"></div>
   

   
<div class="header">
    <a class="logo" href="/">
<img src="/images/ng/logo.png" />
<i></i>
</a>
            <span class="icon iconfont icon-font-setup2" onclick="toSetting()"></span>
    <div class="select" id="ballTypeNav">

<span class="icon iconfont icon-font-footballclass"></span>
        <span>Football</span>

    <ul class="GameList">
        <li class="football">
            <a href="/football/" onclick="toggleBallType()">
                <span class="icon iconfont icon-font-footballclass"></span>
                <span class="name">Football</span>
                <div class="btn icon iconfont icon-font-homepage-off"></div>
            </a>
        </li>

        <li class="basketball">
            <a href="/basketball/" onclick="toggleBallType()">
                <span class="icon iconfont icon-font-basketballclass"></span>
                <span class="name">Basketball</span>
                <div class="btn icon iconfont icon-font-homepage-off"></div>
            </a>
        </li>
            <li class="esports">
                <a href="/esports/" onclick="toggleBallType()">
                    <span class="icon iconfont icon-font-esports"></span>
                    <span class="name">Esports</span>
                    <div class="btn icon iconfont icon-font-homepage-off"></div>
                </a>
            </li>
    </ul>

</div>
</div>

    <div id="navWrapperContainer">
        <div id="navWrapper">
            <ul id="scroller" class="menu">
                <li id="li_score"><a href="/football/" class=on>Scores</a></li>
                            <li id="linews"><a  href="/football/news">Tips</a></li>
                            <li><a href="/football/leagues" >Leagues</a></li>
            </ul>
        </div>
    </div>




   

    <div class="liveTools">
        <div class="tabs">
            <a href="/football/" class="tab on">Live</a>
            <a href="/football/results" class="tab ">Finished</a>
            <a href="/football/today" class="tab ">Fixtures</a>
            <a href="/football/favourites" class="tab ">My Games</a>
        </div>
    </div>

</div>
<div id="matchList" class="matchList">
    <div id="hideCountBar" class="dayrow" style="display:none;">
        Hidden <span id='hiddenCount' class='red'>0</span> ,
        <span class="btn-link" onclick="FilterByOption(0)" style="cursor: pointer;text-decoration: underline;color: #0054a6;">
            show all
        </span>
    </div>
    <div id="gameList">
        <div id="spnLoading" style="margin: 0 auto; padding:5px;width: 80%; ">
            <div class="loaddingBox" id="subSpnLoading">
                <img src="/Images/ng/loading.gif" width="30" height="30">Loading...<div class="loaddingMsg">Nowgoal Livescore</div>
            </div>
        </div>
    </div>
</div>
<div id="popLayer" onclick="hidePopup('popLayer')" style="display:none;">
    <div id="ppDiv">
    </div>
    <div id="ppRedDiv">
    </div>
</div>

<!-- 声音 -->
<div id="sounds" style="display:none">
    <div id="soundsHome" style="display:none"></div>
    <div id="soundsAway" style="display:none"></div>
    <div id="soundsRed" style="display:none"></div>
    <div id="soundsError" style="display:none"></div>
</div>


<div id="returnTop" style="bottom:108px;">
        <span id="btnFilter" onclick="sFilter.nav()" class="flbtn icon iconfont icon-font-screen"></span>

        <a href="/about/feedback/"><span class="tl dl icon iconfont icon-font-small-document"></span></a>

    <span class="tl dl icon iconfont icon-font-open-on" onclick="javascript:window.scroll(0,0);"></span>


</div>

<span id="bfData">
    <script language="javascript" type="text/javascript" defer="defer"></script>
</span>



<script type="text/template" id="tpl_search">
    <div class="searchItem" onclick="toAnalys({$mId})">
        <span class="{$topcss}" onclick="markTopOnSearch({$mId}, this ,event,1)"></span>
        <span class="time">{$mtime}</span>
        <span class="status blue">{$mstate}</span>
        <span class="homeName teamName">{$hname}</span>
        <span class="totalScore blue">{$hscore}-{$gscore}</span>
        <span class="guestName teamName">{$gname}</span>
    </div>
</script>

<script type="text/template" id="tplLeaHeader">
    <div class="group-title {$expcCss}" id="expc_{$lId}" data-leaId="{$lId}" data-lidx="{$index}" onclick="expandleague({$lId})">
        <i id="expl_{$lId}" class="expIcon tri {$explCss}"></i><span class="leaRow" href="{$href}">{$fullName} ({$mNum})</span>
        <div id="sImg_{$lId}" class="icon iconfont icon-font-collect-off {$topCss}" onclick="MarkTopLea({$lId},event,1)"></div>
    </div>
</script>

<script type="text/template" id="rowTplByLea">
    <div id="tb_{$mId}" onclick="toAnalys({$mId})" class="item {$rowcss}" data-mlId="{$lId}" {$expCss}>
        <div class="team {$scoreCss}">
            <div class="status">
                {$vote}
                <span class="time" id="mt_{$mId}">{$mtime}</span>
                <span class="date">{$dtime}</span>
            </div>
            <div id="rht_{$mId}" class="homeTeam">
                <span id="ht_{$mId}" class="name">{$hname}</span>
                    <i>{$hrank}</i>
                    <i id="hR_{$mId}" class="redCard">{$hred}</i>
                    <i id="hY_{$mId}" class="yellowCard">{$hyellow}</i>
            </div>
            <div class="guestTeam">
                <span id="gt_{$mId}" class="name">{$gname}</span>
                    <i>{$grank}</i>
                    <i id="gR_{$mId}" class="redCard">{$gred}</i>
                    <i id="gY_{$mId}" class="yellowCard">{$gyellow}</i>
            </div>
        </div>
        <div class="timeScore">
            <i id="htit_{$mId}">{$htit}</i>
            <div class="home"><span class="odd " id="hht_{$mId}">{$hhscore}</span></div>
            <div class="guest"><span class="odd " id="ght_{$mId}">{$ghscore}</span></div>
        </div>
        <div class="score" id="stat_{$mId}">
            <i id="state_{$mId}">
                {$mstate}
            </i>
            <span class="homeS" id="hsc_{$mId}">{$hscore}</span>
            <span class="guestS" id="gsc_{$mId}">{$gscore}</span>
        </div>
        <div class="odds">
            <i>
                <div class="corner">
                    <i id="cn_{$mId}" class="{$cncss}"></i>
                    <span id="corner_{$mId}">{$corner}</span>
                </div>
                {$lineupClass}
                {$liveClass}
                <div id="tImg_{$mId}" class="icon iconfont icon-font-collect-off {$topCss}" onclick="MarkTop({$mId},event,1)"></div>
            </i>
            <div class="hOdds {$oddsName0}">
                <span id="o1_{$mId}">{$o1}</span>
                <span id="o2_{$mId}">{$o2}</span>
                <span id="o3_{$mId}">{$o3}</span>
            </div>
            <div class="hOdds {$oddsName1}">
                <span id="o4_{$mId}">{$o4}</span>
                <span id="o5_{$mId}">{$o5}</span>
                <span id="o6_{$mId}">{$o6}</span>
            </div>
        </div>
        <br style="clear:both;">
        <div id="exList_{$mId}" class="exbar" style="display:{$showEx}">
            {$explain}
        </div>
    </div>
</script>

<script type="text/template" id="rowTpl">
    <div id="tb_{$mId}" onclick="toAnalys({$mId})" class="item {$rowcss}" data-mlId="{$lId}">
        <div class="team {$scoreCss}">
            <div class="status">
                {$vote}
                <span class="time" id="mt_{$mId}">{$mtime}</span>
                <span href="{$href}" class="gameName leaRow" style="color:{$leaColor}">{$lname}{$tv}</span>
            </div>
            <div id="rht_{$mId}" class="homeTeam">
                <span id="ht_{$mId}" class="name">{$hname}</span>
                    <i>{$hrank}</i>
                    <i id="hR_{$mId}" class="redCard">{$hred}</i>
                    <i id="hY_{$mId}" class="yellowCard">{$hyellow}</i>
            </div>
            <div class="guestTeam">
                <span id="gt_{$mId}" class="name">{$gname}</span>
                    <i>{$grank}</i>
                    <i id="gR_{$mId}" class="redCard">{$gred}</i>
                    <i id="gY_{$mId}" class="yellowCard">{$gyellow}</i>
            </div>
        </div>
        <div class="timeScore">
            <i id="htit_{$mId}">{$htit}</i>
            <div class="home"><span class="odd " id="hht_{$mId}">{$hhscore}</span></div>
            <div class="guest"><span class="odd " id="ght_{$mId}">{$ghscore}</span></div>
        </div>
        <div class="score" id="stat_{$mId}">
            <i id="state_{$mId}">
                {$mstate}
            </i>
            <span class="homeS" id="hsc_{$mId}">{$hscore}</span>
            <span class="guestS" id="gsc_{$mId}">{$gscore}</span>
        </div>
        <div class="odds">
            <i>
                <div class="corner">
                    <i id="cn_{$mId}" class="{$cncss}"></i>
                    <span id="corner_{$mId}">{$corner}</span>
                </div>
                {$lineupClass}
                {$liveClass}
                <div id="tImg_{$mId}" class="icon iconfont icon-font-collect-off {$topCss}" onclick="MarkTop({$mId},event,1)"></div>
            </i>
            <div class="hOdds {$oddsName0}">
                <span id="o1_{$mId}">{$o1}</span>
                <span id="o2_{$mId}">{$o2}</span>
                <span id="o3_{$mId}">{$o3}</span>
            </div>
            <div class="hOdds {$oddsName1}">
                <span id="o4_{$mId}">{$o4}</span>
                <span id="o5_{$mId}">{$o5}</span>
                <span id="o6_{$mId}">{$o6}</span>
            </div>
        </div>
        <br style="clear:both;">
        <div id="exList_{$mId}" class="exbar" style="display:{$showEx}">
            {$explain}
        </div>
    </div>
</script>

<script type="text/template" id="resultRowTpl">
    <div id="rstRow" class="dayrow">Results</div>
</script>

<script type="text/template" id="popRedTpl">
    <div class='cardPopup'>
        <span class='homeTeam' id='redTeam'>
            {$name}<span class='redCard'>
                <span>{$rednum}</span>
            </span>
        </span>
    </div>
</script>

<script type="text/template" id="popTpl">
    <div class='ballInBox'>
        <div class='timeBox'>{$mstate}</div>
        <div class='teamBox'>
            <div class='team home'>
                <div class='name'>{$hname}</div>
                <span class='{$hsCss}'>{$hscore}</span>
            </div>
            <div class='team guest'>
                <div class='name'>{$gname}</div>
                <span class='{$gsCss}'>{$gscore}</span>
            </div>
        </div>
    </div>
</script>



<script id="filterNavTpl" type="text/template">
    <div class="title">
        <span>Filter</span>
        <div class="close_b" onclick="sFilter.hide()"></div>
    </div>
    <div class="info">
        <ul>
            <li onclick="sFilter.toView(1)">
                <div class="name">Filter By Leagues</div>
                <i class="more"></i>
            </li>
            <li onclick="sFilter.toView(2)">
                <div class="name">Filter By Countries</div>
                <i class="more"></i>
            </li>
                <li onclick="sFilter.toView(3)">
                    <div class="name">Filter By Odds</div>
                    <i class="more"></i>
                </li>
            <li {$hotshow} onclick="sFilter.action(1,'hotmatch')">
                <div class="name">Show Hot Matches ({$hotCount})</div>
                <i class="more"></i>
            </li>
            <li {$favleashow} onclick="sFilter.action(2,'favlea')">
                <div class="name">Favourite Leagues Matches ({$favLeaCount})</div>
                <i class="more"></i>
            </li>
            <li {$favshow} onclick="sFilter.action(3,'fav')">
                <div class="name">Favourite Matches ({$favCount})</div>
                <i class="more"></i>
            </li>
            <li>
                <div class="name">Show Only Odds</div>
                <div class="selectLabel">
                    <label class="switch">
                        <input type="checkbox" {$onlyOddsChecked} id="cb_only_odds" onclick="sFilter.action(4,'oOdds',event)">
                        <span class="switch-style"></span>
                    </label>
                </div>
            </li>
            <li>
                <div class="name">Matches&#39; Order</div>

                    <ul class="setList" id="set_sorting">
            <li data-opt="0" onclick="sFilter.action(5, 'bytime')" class="{$ob_timeCls}"><span class="ro"></span>By Time</li>
            <li data-opt="1" onclick="sFilter.action(6, 'bylea')" class="{$ob_leaCls}"><span class="ro"></span>By League</li>
    </ul>

            </li>
        </ul>
    </div>
</script>


<script id="filterTypesTpl" type="text/template">
    <div class="title">
        <div class="HTabs">
            <span class="tab" onclick="toggleFilterPop(1)" id="btnLeague">Leagues</span>
            <span class="tab" onclick="toggleFilterPop(2)" id="btnCountry">Countries</span>
                <span class="tab" onclick="toggleFilterPop(3)" id="btnGoalOdds">Odds</span>
        </div>
        <div class="close_b" onclick="sFilter.hide()"></div>
    </div>

    <div style="padding-bottom: 36px;" class="info">
        <div class="dbList">
            <div class="msg">
                Total:<span class="red" id="mTotal">0</span>
                , Selected : <span class='red' id='visibleCount'>0</span>
            </div>
            <ul id="leaFilter_list"></ul>
            <ul id="countryFilter_list"></ul>
                <ul id="oddsFilter_list"></ul>

        </div>
    </div>
    <div class="box-footer">
        <div class="button" id="toolSimp" onclick="quickSelect(2)">Hot</div>
        <div class="button" onclick="quickSelect(0)">Select All</div>
        <div class="button" onclick="quickSelect(1)">Clear All</div>
        <div class="button on" onclick="ConfirmFilter()">OK</div>
    </div>
</script>

<script id="fplrowTpl" type="text/template">
    <li id="fBtn_{$Id}" class="{$onCls}" onclick="checkFilterItem({$Id}, this)" data-id="{$Id}" data-mnum="{$mNum}" data-onum="{$oNum}">
        <span class="cb"></span>{$name}
        <i id="fBtn_num_{$Id}">({$con})</i>
        <div id="fp_sImg_{$Id}" class="icon iconfont icon-font-collect-off {$topCls}" onclick="MarkTopLea({$Id},event,1)"></div>
    </li>
</script>

<script src="/scripts/soccer/v1/scoreutil.js?v=637441593270000000"></script>
<script src="/scripts/soccer/scoreutil.js?v=637469124580000000"></script>
<script src="/scripts/soccer/scoreFilter.js?v=637441593270000000"></script>
<script src="/scripts/soccer/v1/score.js?v=637426681160000000"></script>
<script src="/scripts/soccer/score.js?v=637469124580000000"></script>
<script src="/scripts/common/settingUtil.js?v=637469124580000000"></script>
<script src="/scripts/ng/scoreDiff.js?v=637469124580000000"></script>
<script src="/scripts/ng/touchad.js?v=637478833300000000"></script>


<script type="text/javascript">
    var _ScoreOnly = 0;
    var _scoreTxtForMatch = "bf_us1";
    var _scoreTxt = "bf_us";
    loadData();
</script>
       
<div id="footer">
        <div class="webid">
            <a href="/">Nowgoal.pro</a><span class="li"></span><a target="_blank" href="https://www.goaloo.com/">Goaloo.com</a>
        </div>
        <div class="newlogoBar">
            <div class="newLogoLeft">
                <a class="newlogo" href="//www.nowgoal3.com?from=m">
                    <img width="22" src="/Images/com/pc.png"> Desktop View
                </a>
            </div>
            <div class="newLogoRight">
                <a class="newlogo" href="/download/">
                    <img width="22" src="/Images/com/iphone.png"> App
                </a>
            </div>
        </div>
        <div class="newlogoBar">
            <div class="newLogoLeft">
                <a class="newlogo" href="/football/">
                    <img width="22" src="/Images/com/football.png"> Football
                </a>
            </div>
            <div class="newLogoRight">
                <a class="newlogo" href="/basketball/">
                    <img width="22" src="/Images/com/Basketball.png"> Basketball
                </a>
            </div>
        </div>
        <div class="FMenu">
            <a target="_self" href="/about/adcontact">Advertise</a>
            &nbsp;|&nbsp;
            <a target="_self" href="/about/disclaimer">Disclaimer</a>
            &nbsp;|&nbsp;
            <a target="_self" href="/about/feedback">Feedback</a>
            &nbsp;|&nbsp;
            <a target="_self" href="/sitemap">Sitemap</a>
        </div>
        <div class="network">
            <a targer='_blank' href="https://vm.tiktok.com/ZSq1Sy9V/"><img src="/images/share/TikTok.png"><span>TikTok</span></a>
            <a targer='_blank' href="https://www.facebook.com/Nowgoalsoccer"><img src="/images/share/facebook.png"><span>Facebook</span></a>
            <a targer='_blank' href="https://twitter.com/NowgoalScore"><img src="/images/share/Twitter.png"><span>Twitter</span></a>
            <a targer='_blank' href="https://www.instagram.com/nowgoal3/?igshid=1hrl7mgot5h9h"><img src="/images/share/Instagram.png"><span>Instagram</span></a>
        </div>

    <div class="msg2">
        <span>© 2021 <a href='/'>Nowgoal</a> All Rights Reserved.</span>
        <span>Global Pacific Electronic Technology Limited</span>
    </div>
        <div class="msg">
            <div class="webdesc">
                Nowgoal's Mobi version can offer you the fast soccer(football) and basketball livescores every time, every where.
Nowgoal's livescore system is supplying the real time scores for more than 1000 football + basketball competitions! Livescore, latest results, standings, fixtures, H2H stats and odds comparison.
Nowgoal is a socially responsible sports informational website, we support responsible sports entertainment. You must be at least 18 years of age to use our info and must comply with laws and regulation in your own country.
                <div class="showALL">
                    Show ALL
                </div>
            </div>
        </div>
    </div>
<br style="clear:both;" />
<div style="display:none;">
    <div id="allCnzz" style="display:none;"> </div>
    <script>
        if (typeof (_lazzyLoadCnzz) == "undefined" || !_lazzyLoadCnzz)
            showCountDefer();
    </script>
</div>
        <div id="popContainer"></div>
<script type="text/template" id="tplPop">
    <div class="popupBox" id="popupBox" onclick="javascript:popUtil.closePopup(1)">
        <div class="popupBox--info" onclick="cancelBubble(event)">
            <div class="popupBox--title" {$showTitle}>{$title}</div>
            <div class="popupBox--body" onclick="cancelBubble(event)" {$bodyStyle}>
                {$body}
            </div>
            <div class="popupBox--footer" onclick="cancelBubble(event)" {$showFoot}>
                {$footer}
            </div>
        </div>
</div>
</script>
<script type="text/html" id="tplPop_btn">
    <div class="{$btnCss} inline btn" onclick="javascript:{$func}">{$title}</div>
</script>

       
        <script src="/scripts/common/viewutil.js?v=637478802480000000"></script>
<script src="/scripts/ng/viewutil.js?v=637469124580000000"></script>

    </div>
</body>
</html>

Would anyone like to help me how to proceed to convert from ie to xlmhttp?

Thanks
 

Attachments

  • Elements.jpg
    Elements.jpg
    46.8 KB · Views: 3

Bruzio

Board Regular
Joined
Aug 20, 2020
Messages
85
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile

ADVERTISEMENT

Using xmlhttp the table is ready?
 

Attachments

  • loading.jpg
    loading.jpg
    55.4 KB · Views: 4

Worf

Well-known Member
Joined
Oct 30, 2011
Messages
4,126
The page is not loading. Would you like a solution using Chrome?

VBA Code:
Sub inplayxml()
Dim item As Object, r As Integer, http As Object, html As HTMLDocument
Set http = New MSXML2.XMLHTTP60
Set html = New HTMLDocument
http.Open "GET", "https://www.nowgoal.pro/", False
http.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
http.send
Application.Wait (Now + TimeValue("00:00:25"))
html.body.innerHTML = http.responseText
r = 2
If InStr(1, http.responseText, "Loading", 0) > 0 Then MsgBox "Still loading...", , CStr(http.Status)
For Each item In html.getElementsByClassName("item")
    With Sheets("inplay")
        .Range("A" & r).Value = item.getElementsByClassName("gameName leaRow")(0).innerText
        .Range("B" & r).Value = _
        Trim(item.getElementsByClassName("homeTeam").item(0).getElementsByTagName("span").item(0).innerText)
        .Range("C" & r).Value = _
        Trim(item.getElementsByClassName("guestTeam").item(0).getElementsByTagName("span").item(0).innerText)
    End With
    r = r + 1
Next
End Sub
 

Bruzio

Board Regular
Joined
Aug 20, 2020
Messages
85
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile

ADVERTISEMENT

As I said
I tried with winhttp method too, but the result is no output. I haven't much experience with vba.

Chrome is faster then IE?
 

Worf

Well-known Member
Joined
Oct 30, 2011
Messages
4,126
Chrome should be faster, but you have to install Selenium, see the fourth post in the thread below.

VBA Code:
Sub inplay_sel()
Dim driver As ChromeDriver, icol, i%, sh As Worksheet
Set sh = Sheets("inplay")
Set driver = New ChromeDriver
driver.get "https://www.nowgoal.pro/"
Application.Wait (Now + TimeValue("00:00:05"))
Set icol = driver.FindElementsByClass("item")
For i = 1 To icol.Count
    sh.Range("a" & i) = icol(i).FindElementsByClass("gameName")(1).Text
    sh.Range("b" & i) = _
    icol(i).FindElementsByClass("homeTeam")(1).FindElementsByTag("span")(1).Text
    sh.Range("c" & i) = _
    icol(i).FindElementsByClass("guestTeam")(1).FindElementsByTag("span")(1).Text
Next
End Sub

import data from Web
 

diddi

Well-known Member
Joined
May 20, 2004
Messages
3,267
Office Version
  1. 2010
Platform
  1. Windows
what data do you need in the scrape
 

Bruzio

Board Regular
Joined
Aug 20, 2020
Messages
85
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
Chrome should be faster, but you have to install Selenium, see the fourth post in the thread below.

VBA Code:
Sub inplay_sel()
Dim driver As ChromeDriver, icol, i%, sh As Worksheet
Set sh = Sheets("inplay")
Set driver = New ChromeDriver
driver.get "https://www.nowgoal.pro/"
Application.Wait (Now + TimeValue("00:00:05"))
Set icol = driver.FindElementsByClass("item")
For i = 1 To icol.Count
    sh.Range("a" & i) = icol(i).FindElementsByClass("gameName")(1).Text
    sh.Range("b" & i) = _
    icol(i).FindElementsByClass("homeTeam")(1).FindElementsByTag("span")(1).Text
    sh.Range("c" & i) = _
    icol(i).FindElementsByClass("guestTeam")(1).FindElementsByTag("span")(1).Text
Next
End Sub

import data from Web
Thank you so much. I will try
 

Watch MrExcel Video

Forum statistics

Threads
1,127,333
Messages
5,624,066
Members
416,010
Latest member
NJT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top