Armory link in export

Questions and discussions on development tools for WarcraftRealms
Locked
umiya
Posts: 1
Joined: Mon Dec 22, 2008 4:51 pm

Armory link in export

Post by umiya »

So i am creating a guild roster with the info I have found here but one think i would like to do is add armory link to the characters name

Code: Select all

   //
    //  Rostertest.php
    //
    //  Sample guild export downloader and display
    //  You may use this script as you wish.  This is only some sample code
    //  provided to help get a jumpstart!
    //
    //  Created: 1/27/2005   
    //
    //  Author:  Cooper Sellers aka Rollie - Bloodscalp
    //

    $local_directory = "./status_roster/";     //  this is the directory where your local files
                                //  will be written to and read from.  Make sure
                                //  you have WRITE priveledges on this directory

    $guild_id        = 3362050;   //  get this number from the link posted on the
                                //  guilddisplay.php page
                               


    //
    //  Remember to check the status file so that you are not pulling data
    //  more than once per day
    //
    $localstatusfile = $local_directory . "status.txt";
    $infile = fopen ($localstatusfile, "r");
    $current_timestamp = 0;
    if (!$infile)
    {
        echo "<p>No status file available, assuming this is the first run<br>";
    &#125;
    else
    &#123;
        //  read our status file time
        $buffer = fgets&#40;$infile, 4096&#41;;

        $current_timestamp = trim&#40; $buffer &#41;;

        echo 'Local status file reads &#58; ' . strftime&#40;"%m/%d/%y %H&#58;%M&#58;%S",$current_timestamp&#41; . '<br>';
    &#125;
    fclose&#40; $infile &#41;;         //  close our local status file
   
    $filename = "http&#58;//www.warcraftrealms.com/exports/status.txt";
    $infile = fopen &#40;$filename, "r"&#41;;   // open remote status file
    if &#40;!$infile&#41;
    &#123;
        echo "<p>Unable to open status file.<br>";
        exit;
    &#125;

    $remote_timestamp = 0;
    if&#40;!feof &#40;$infile&#41;&#41;   // only 1 read should be needed for the status file
    &#123;
        $buffer = fgets&#40;$infile, 4096&#41;;
        $remote_timestamp = trim&#40; $buffer &#41;;

        echo 'Remote status file reads &#58; ' . strftime&#40;"%m/%d/%y %H&#58;%M&#58;%S",$remote_timestamp&#41; . '<br>';

    &#125;
    fclose&#40; $infile &#41;;  //  close the remote status file

    if&#40; $remote_timestamp - $current_timestamp > 86400 &#41; //  1 day = 60*60*24
    &#123;
        //
        //  We can do a full get
        //

        //  write our new status file
        $outfilename = $local_directory . "status.txt";
        $outfile = fopen&#40;$outfilename, "w"&#41;;
        if&#40; !$outfile &#41;
        &#123;
            echo "<p>Unable to open save file => " . $outfilename . "<br>";
            exit;
        &#125;

        fputs&#40;$outfile, $buffer&#41;;
        fclose&#40;$outfile&#41;;

        //
        //  Now get our guild roster file
        //
        $filename = 'http&#58;//www.warcraftrealms.com/exports/guildexport.php?guildid=' . $guild_id;
        $infile = fopen &#40;$filename, "r"&#41;;
        if &#40;!$infile&#41;
        &#123;
            echo "<p>Unable to open remote file.<br>\n";
            exit;
        &#125;

        $outfilename = $local_directory . "guildroster.csv";
        $outfile = fopen&#40;$outfilename, "w"&#41;;
        if&#40; !$outfile &#41;
        &#123;
            echo "<p>Unable to open save file => " . $outfilename . "<br>\n";
            exit;
        &#125;

        while &#40;!feof &#40;$infile&#41;&#41;
        &#123;
            $buffer = fgets&#40;$infile, 4096&#41;;
            fputs&#40;$outfile, $buffer&#41;;
        &#125;

        fclose&#40;$outfile&#41;;
        fclose&#40;$infile&#41;;
    &#125;



    //
    //  Now let's just output our roster as it's given
    //
    $filename = $local_directory . "guildroster.csv";
    $infile = fopen &#40;$filename, "r"&#41;;
    if &#40;!$infile&#41;
    &#123;
        echo "<p>Unable to open local roster file.<br>";
        exit;
    &#125;

    //  do one read to get the header
    $buffer = fgets&#40;$infile, 4096&#41;;

    //  read the entries
    echo '<table><strong><tr><th>Name</th><th>Race</th><th>Class</th><th>Level</th><th>Last Seen</th></strong></tr>';
    while &#40;!feof &#40;$infile&#41;&#41;
    &#123;
        $buffer = fgets&#40;$infile, 4096&#41;;
        list&#40; $name, $race, $class, $level, $last_seen, $rank &#41; = explode&#40;",",$buffer&#41;;

        echo '<tr><td>' . $name . '</td><strong><td>' . $race . '</td></strong><td>' . $class . '</td><td>' . $level . '</td><td>' . $last_seen . '</td></tr>';
    &#125;
    echo '</table>';


here is my code i am working with. thanks for help in advance

Locked