Created
March 10, 2015 00:24
-
-
Save ozero/ad776df86a4c3effeac4 to your computer and use it in GitHub Desktop.
extract from damage report html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Ingress: extract portal name, lat&long, address, agent name and date | |
from html files of Ingress damage report email which exported | |
from thunderbird addon 'Import/Export tools'. | |
*/ | |
$files=glob("./*/*.*"); | |
$regx_agent="\sby\s.*?<span.*?>(.*?)<"; | |
$regx_date="Date:\s</div>(.*?)<"; | |
$regx_portal='em;"><div>(.*?)</div><div><a.*?pll=(.*?)&z=.*?>(.*?)</a></div>'; | |
$ext=array(); | |
foreach($files as $k0=>$v0){ | |
$content = join("",file($v0)); | |
preg_match("#{$regx_agent}#",$content,$tmp_agent); | |
preg_match("#{$regx_date}#",$content,$tmp_date); | |
preg_match("#{$regx_portal}#",$content,$tmp_portal); | |
$ext[] = array( | |
'agent'=>$tmp_agent[1], | |
'date'=>$tmp_date[1], | |
'pname'=>$tmp_portal[1], | |
'pll'=>$tmp_portal[2], | |
'paddr'=>$tmp_portal[3], | |
); | |
} | |
print_r($ext); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment