TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 12-05-2009, 03:18 PM   #1 (permalink)
The Acquainted
 
Join Date: Nov 2009
Location: nr Stratford-Upon-Avon
Posts: 137
Thanks: 3
maeltar is on a distinguished road
Default Pulling my hair out....

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 ($chCURLOPT_URL$url);
        
curl_setopt ($chCURLOPT_RETURNTRANSFER1);
        
curl_setopt ($chCURLOPT_CONNECTTIMEOUT15);
        
curl_setopt ($chCURLOPT_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'NULLNULL);

$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...
__________________
Thanks... Simon

Sex, Drugs & Linux Rules
Send a message via MSN to maeltar
maeltar is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pulling values from one site as reference 9three Absolute Beginners 4 02-17-2009 02:37 PM
Wishing I had hair to pull out... MattD Absolute Beginners 4 02-14-2009 12:24 AM
[PHP/MySQL] Pulling Multiple Rows *Solved* Andrew General 3 10-19-2007 07:10 PM


All times are GMT. The time now is 11:13 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design