Hello one and all - lla dna eno elloH

I have been playing a browser based game called Travian for some time now, a friend and I have made an alliance in this game and have currently created a website and forums for this. (also because this is our web design qualification)

We have one problem though.
We wish to display our alliance statistics but we can't do it without it being manual.

Is there a script that will look into the Travian statistics and send the information to our server and display it.

If you can shed any light I will be most grateful.

Thank you
Grant

Dani AI

Generated

— two realistic ways to automate alliance statistics for a Travian site: scrape the public stats pages and parse the HTML on your server, or use an authenticated/scripted approach if the stats are behind a login or generated by JavaScript. Scraping the public pages is usually the simplest, but check Travian's terms of service and server rules first — automated access can get a game account or IP blocked, and page markup can change at any time.

A practical workflow:

  1. Identify the stats page URL you want to mirror (alliance ranking, players, points).
  2. Write a small server-side fetcher (PHP/Python) that GETs that page, parses the DOM, extracts the fields you need, and stores them in a database or JSON file.
  3. Run the fetcher on a schedule (cron) and render the cached data on your site. Cache aggressively and use a low frequency (every 5–30 minutes) to avoid load.

Example PHP skeleton (adjust URL and XPath to match the Travian page):

<?php
$url = 'https://your-travian-server.example/statistics.php?type=alliance&aid=123';
$ch = curl_init($url);
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_USERAGENT => 'AllianceStatsBot/1.0 (+https://yourdomain.example)',
]);
$html = curl_exec($ch);
curl_close($ch);

libxml_use_internal_errors(true);
$dom = new DOMDocument;
$dom->loadHTML($html);
libxml_clear_errors();

$xpath = new DOMXPath($dom);
$rows = $xpath->query("//table[contains(@class,'statistics')]//tr");
foreach ($rows as $r) {
  $cols = $r->getElementsByTagName('td');
  if ($cols->length) {
    $rank = trim($cols->item(0)->textContent);
    $name = trim($cols->item(1)->textContent);
    $points = trim($cols->item(2)->textContent);
    // insert/update your DB here
  }
}
?>

If the stats page requires login or is rendered by JavaScript, simulate a login with cURL (cookie jar + POST credentials) or use a headless browser (Selenium/Playwright) to render and scrape. Always handle character encodings, errors, and changes in HTML structure.

Troubleshooting tips:

  • Test fetches from command line (curl) to see raw HTML.
  • Use XPath/DOM parsing; avoid fragile regex.
  • Respect rate limits, rotate delays, and log HTTP errors.
  • If banned or blocked, reduce frequency or ask Travian support about allowed access.

was correct that this is a WebDevelopment-level task; the outline above is the practical next step. — questions about how to play Travian are separate from this development task.

Recommended Answers

All 2 Replies

how i can play travian

Welcome Grant. You will however have to post your question in the WebDevelopment Forum for an answer. Hope you get the answer soon. The forum link is right at the top of this page.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.