Weper Weper - 2 months ago 5
C# Question

Get source from a Website with anchor tag

I play on a private WoW server and i want to get the player names from the Website.

I tried with the

method but it doesn't works.

Here is the link:
but I can get the source just from /information.
It does not consider the #allrealm tag. So I can't get the player names.

How can I get the source code from the website using the


The details of the users are loaded by an Ajax call as you can see if you open the Developer Tools of your webbrowser:

developer tools showing ajax calls

You need to fed the DownloadString method with that XHR url:

using(var wc = new WebClient())
    wc.Encoding = Encoding.UTF8;
    var all = wc.DownloadString("https://tauriwow.com/allrealm/ajax");

The content you get is html, so you have to do the parsing of that by yourself, maybe using a library like CsQuery

When you run above snippet this is what you get:

<div class="lft realmBox realmBoxFirsts">
    <div class="realmTitle">
        <div class="subtitle"><div class="lft"><b>&raquo;</b></div><div class="lft subtitle2">Tauri WoW Server</div><div class="rgt realmType">RPPvP</div></div>
        <div class="realmStats"><a href="/allrealm/12">Detailed statistics</a></div>
        <div class="realmDetails">
                                            1) Acélember (<font style="color: lightblue;">20</font>)<br />2) Adjádékát (<font style="color: lightblue;">1</font>)<br />3) Adoresta