Ander Gonzalez Ortiz Ander Gonzalez Ortiz - 2 years ago 70
PHP Question

How to copy a div contenent to a txt file from a large html page

I need to copy the number of percent of the progress bar from this page to a txt file. (

I have tried something like this:

$(document).on("ready", function() {
setInterval(querygoal, 5000);
$(".navbar-brand").tooltip({placement: "bottom", html: true});

function querygoal() {
url: "view-source:",
method: "GET",
success: function(res){
if (res["status"]) {

function actualizarJugadores2(num) {
var digitos = ("" + num).split("");
var elem = $(".goal").children("dd");
for (index = 0; index < digitos.length; index++){
elem.append("<span>" + digitos[index] + "</span>")
var color = "#F1A90F";

if (num==0) {
color = "#d9534f"

Anyone can help me?

Thanks in advance.

Answer Source

Your question is tagged as PHP, so I guess that's an alternative? Simply parse the webpage with PHP Simple HTML DOM Parser. In the example beneath I use the style attribute to find the correct paragraph.


    include 'simple_html_dom.php';

    $html = file_get_html('');

    foreach($html->find('p[style="text-align:center; font-size:14px;"]') as $item) {
        $result = trim($item->plaintext);

    $progress = explode( ' ', $result)[0];
    echo $progress;


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download