WarcraftReamls.com
  FAQFAQ    SearchSearch    MemberlistMemberlist    UsergroupsUsergroups   RegisterRegister 
  ProfileProfile    Log in to check your private messagesLog in to check your private messages    Log inLog in 
Armory link in export

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    WarcraftRealms.com Forum Index -> WarcraftRealms Developers
View previous topic :: View next topic  
Author Message
umiya



Joined: 22 Dec 2008
Posts: 1

WR Updates: 0
umiya WR Profile

PostPosted: Mon Dec 29, 2008 11:22 am    Post subject: Armory link in export Reply with quote

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:
   //
    //  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>";
    }
    else
    {
        //  read our status file time
        $buffer = fgets($infile, 4096);

        $current_timestamp = trim( $buffer );

        echo 'Local status file reads : ' . strftime("%m/%d/%y %H:%M:%S",$current_timestamp) . '<br>';
    }
    fclose( $infile );         //  close our local status file
   
    $filename = "http://www.warcraftrealms.com/exports/status.txt";
    $infile = fopen ($filename, "r");   // open remote status file
    if (!$infile)
    {
        echo "<p>Unable to open status file.<br>";
        exit;
    }

    $remote_timestamp = 0;
    if(!feof ($infile))   // only 1 read should be needed for the status file
    {
        $buffer = fgets($infile, 4096);
        $remote_timestamp = trim( $buffer );

        echo 'Remote status file reads : ' . strftime("%m/%d/%y %H:%M:%S",$remote_timestamp) . '<br>';

    }
    fclose( $infile );  //  close the remote status file

    if( $remote_timestamp - $current_timestamp > 86400 ) //  1 day = 60*60*24
    {
        //
        //  We can do a full get
        //

        //  write our new status file
        $outfilename = $local_directory . "status.txt";
        $outfile = fopen($outfilename, "w");
        if( !$outfile )
        {
            echo "<p>Unable to open save file => " . $outfilename . "<br>";
            exit;
        }

        fputs($outfile, $buffer);
        fclose($outfile);

        //
        //  Now get our guild roster file
        //
        $filename = 'http://www.warcraftrealms.com/exports/guildexport.php?guildid=' . $guild_id;
        $infile = fopen ($filename, "r");
        if (!$infile)
        {
            echo "<p>Unable to open remote file.<br>\n";
            exit;
        }

        $outfilename = $local_directory . "guildroster.csv";
        $outfile = fopen($outfilename, "w");
        if( !$outfile )
        {
            echo "<p>Unable to open save file => " . $outfilename . "<br>\n";
            exit;
        }

        while (!feof ($infile))
        {
            $buffer = fgets($infile, 4096);
            fputs($outfile, $buffer);
        }

        fclose($outfile);
        fclose($infile);
    }



    //
    //  Now let's just output our roster as it's given
    //
    $filename = $local_directory . "guildroster.csv";
    $infile = fopen ($filename, "r");
    if (!$infile)
    {
        echo "<p>Unable to open local roster file.<br>";
        exit;
    }

    //  do one read to get the header
    $buffer = fgets($infile, 4096);

    //  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 (!feof ($infile))
    {
        $buffer = fgets($infile, 4096);
        list( $name, $race, $class, $level, $last_seen, $rank ) = explode(",",$buffer);

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




here is my code i am working with. thanks for help in advance
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    WarcraftRealms.com Forum Index -> WarcraftRealms Developers All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
WarcraftRealms.com  


Powered by phpBB © 2001, 2005 phpBB Group