Hi am relatively new to PHP and am i am currently learning. So i am creating a parser for a game i play to parse some information, break it down it to it different elements and then store it.
Where i'm stuck is how to break it up into its different elements, i'm searching for tutorials for it but though i'd post here and see if i get a reply faster 🙂
ok here is what i'm trying to parse
2005.11.15 22:49:00
Victim: Winged Jaguar
Alliance: The Five
Corporation: Supremacy
Destroyed Type: Thorax
Solar System: Esa
System Security Level: 0.8
Involved parties:
Name: Silvitni
Security Status: 1.6
Alliance: NBSI Alliance
Corporation: Euphoria Released
Ship Type: Capsule
Weapon Type: Light Neutron Blaster II
Name: Parity (laid the final blow)
Security Status: -1.5
Alliance: NBSI Alliance
Corporation: Maza Nostra
Ship Type: Armageddon
Weapon Type: Mega Pulse Laser II
Name: Skidd Chung
Security Status: 0.6
Alliance: NBSI Alliance
Corporation: Euphoria Released
Ship Type: Moa
Weapon Type: Moa
Name: Edenmain
Security Status: 0.4
Alliance: NBSI Alliance
Corporation: Euphoria Released
Ship Type: Crow
Weapon Type: Thorn Rocket I
Destroyed items:
Type: Plutonium Charge S (Cargo)
Quantity: 3982
Type: J5b Phased Prototype Warp Inhibitor I (Fitted - Medium slot)
Type: Antimatter Charge S (Cargo)
Quantity: 6700
Type: Light Ion Blaster II (Fitted - High slot)
Type: Light Ion Blaster II (Fitted - High slot)
Type: Light Ion Blaster II (Fitted - High slot)
Type: Medium Armor Repairer II (Fitted - Low slot)
Type: Energized Adaptive Nano Membrane II (Fitted - Low slot)
Type: Energized Reactive Membrane I (Fitted - Low slot)
Type: Plutonium Charge S (Fitted - High slot)
Quantity: 55
now i have managed to break up each line into strings, and view the strings in a var_dump but then am at a loss as how to get the info i need.
When ever a 'killmail' is posted it will have the same format as posted above but different character names, weapons, corporations, etc. How do i get it to recognise the Victim: or Alliance and only store the name of the character e.g Winged Jaguar?
Any ideas or where to look , useful tutorials, will be greatly appreciated. BTW here is how i'm breaking it up into strings, is this right:
$KillMail = explode( "\n", $a );
foreach( $KillMail as $Line )
{
$Clean = htmlentities( trim( $Line ), ENT_QUOTES );
}
echo '<pre>';
var_dump ($KillMail);
echo '</pre>';