Jump to content

Help with some


mill

Recommended Posts

 

What im trying to do is export the Stats of wins / losses / % and last game played to add to a database, need some help making something that will  pull all that information any ideas? if you look at the html page im linking you can see what i mean i want to call this info

 

Last Ladder Game: Nov. 17th 2007

Ex:

Undead:    39    36    52.00

Human:    39    36    52.00

Total:        55 55          93.3

 

and have it so i can insert it into a mysql database

 

 

<?php

 

$text = file_get_contents("http://www.battle.net/war3/ladder/w3xp-player-profile.aspx?Gateway=Azeroth&PlayerName=Dayvinn-");

 

 

 

if (preg_match("/Undead/", $text, $matches)) {

  echo "Match was found

";

  echo $matches[0];

}

 

?>

 

 

 

 

 

 

Link to comment
Share on other sites

try

<?php
$text = file_get_contents("http://www.battle.net/war3/ladder/w3xp-player-profile.aspx?Gateway=Azeroth&PlayerName=Dayvinn-");
preg_match_all('/ranking(Header|Row)">([^<]*)</', $text, $out);
$out = array_chunk($out[2], 4);
print_r($out);
?>

Link to comment
Share on other sites

Thank you it does work outputs:

 

Array
(
    [0] => Array
        (
            [0] => 
            [1] =>  Wins 
            [2] =>  Losses 
            [3] =>  Win % 
        )

    [1] => Array
        (
            [0] => Random:
            [1] => 1
            [2] => 8
            [3] => 11.11 %
        )

    [2] => Array
        (
            [0] => Human:
            [1] => 259
            [2] => 272
            [3] => 48.78 %
        )

    [3] => Array
        (
            [0] => Orc:
            [1] => 5
            [2] => 15
            [3] => 25.00 %
        )

    [4] => Array
        (
            [0] => Undead:
            [1] => 39
            [2] => 36
            [3] => 52.00 %
        )

    [5] => Array
        (
            [0] => Night Elf:
            [1] => 57
            [2] => 29
            [3] => 66.28 %
        )

    [6] => Array
        (
            [0] => Total:
            [1] => 361
            [2] => 360
            [3] => 50.07 %
        )

 

Now say i wanted something from array [6],[1] Being: 361 how would i make that code?

Link to comment
Share on other sites

Thanks it works great...

 

Ive been trying to get more info off the site but i can only pull up some of it.....

 

 


Array
(
    [0] => Array
        (
            [0] => Player Name:
            [1] => Clan Name:
            [2] => Homepage:
            [3] => Last Ladder Game:
        )

    [1] => Array
        (
            [0] => Play History:
            [1] => Exp:
            [2] => Rank: 
            [3] => Wins:
        )

    [2] => Array
        (
            [0] => Losses:
            [1] => XP decay in: 
        )

)

 

 

No matter what i try i can only pull up that info, is there a way to get whats after that?

 

Im using this as my code

 

 

 

preg_match_all('/ranking(Data)">([^<]*)</', $text, $out2);

$out2 = array_chunk($out2[2], 4);



print_r($out2);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.