Ok, I have an issue that I "think" could be filesystem related, trouble is I'm not using php for all parts, am using some php, some python and glueing them together with a bash script !
Overview..
What I am trying to do it create a system that deals with information from the "World of Warcraft Armory"..
The first php file is run as a script, and exports the characters returned to a text file.
First the PHP, that works fine and does excatly what I want it to do...
PHP Code:
<?
class armory {
const BROWSER="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20070319 Firefox/2.0.0.3";
public $query;
public $server;
public $guild;
public $guildie;
public $page;
public function __construct ( $query, $server, $guild, $guildie, $page ) {
$this->query = $query;
$this->server = $server;
$this->guild = $guild;
$this->guildie = $guildie;
$this->page = $page;
} // end of __construct()
public function pull_xml() {
$url = 'http://eu.wowarmory.com/guild-info.xml?r=' . urlencode($this->server) . '&n=' . urlencode($this->guild) . '&p=' . $this->page;
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt ($ch, CURLOPT_USERAGENT, self::BROWSER);
$url_string = curl_exec($ch);
curl_close($ch);
return simplexml_load_string($url_string);
} // end of pull_xml()
} // end class
$xml_obj = simplexml_load_string($xml);
$armory = new armory('roster', 'Khadgar', 'Aeturnus Recuso', NULL, NULL);
$xml = $armory->pull_xml();
foreach ($xml->guildInfo->guild->members->character as $char)
{
if( $char['level'] == '80' )
{
echo iconv("UTF-8", "ISO-8859-1", $char['name']) . "\n";
}
}
?>
Now for a touch of BASH and python, this part reads the roster list (created from the above php code) then drags a line out at a time and throws another query at the Warcraft Armoury to get ALL the Achievements for each character listed in the roster file (one name per line). The output from the python script is redirected to a text file, one per character listing all achievements completed or not..
Ok, now this is where I have the problem...
The roster list displays the character names correctly with their funky characters.
http://maeltar.homelinux.net/sandbox...ist_sorted.txt
The problem lays with the file names created by the BASH script, so that I think is filesystem based...
Code:
for member in $(cat ./cache/roster_list_sorted.txt)
do
time_start=`date +%s`
echo Processing $member
./achievement_printer.py --eu -r Khadgar -p $member > ./cache/$member.ach
time_end=`date +%s`
time_exec=`expr $(( $time_end - $time_start ))`
echo "$time_exec seconds"
done
Ok, now this is where I have the problem...
What i would like to do now, is to process the files and create pretty web pages with the data form each file, not a difficult task in any way, apart from the filenames...
Any ideas ? or should I go back to the drawing board and see if I can write something in PHP that will do the job of the python script (The python script is not my work)
I guess am just looking for pointers really...
The files are stored
http://maeltar.homelinux.net/sandbox/wow-scripts/cache/
Have a look and see what I mean about the names...
I have a sneaky feeling am going to have to write someting in PHP to do it...