[ Launch: reddit base ] 99a41ca041c2ac965c3e by ababkov
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 | |
$json = json_decode(file_get_contents("source.json"),true); | |
$fh = fopen("target.csv","w+"); | |
fputcsv($fh,array_keys(current($json))); | |
foreach($json as $row){ | |
fputcsv($fh,$row); | |
} |
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 | |
$xml_file_path = dirname(__FILE__)."/reaxml.xml"; | |
$csv_file = dirname(__FILE__)."/current-listings.csv"; | |
$xmlr = new XMLReader(); | |
$opened = $xmlr->open($xml_file_path); | |
if( !$opened ){ | |
throw new Exception("WARN: Could not open XML file '{$xml_file_path}'. Please check it exists and is valid."); | |
} |
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 | |
use Monolog\Handler\NullHandler; | |
use Monolog\Handler\StreamHandler; | |
use Monolog\Logger; | |
$example_timezone = "Australia/Brisbane"; | |
$logger = new Logger($name); |
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
function expandExpression($path,$depth=3,$marker="/**/"){ | |
$e_path = explode($marker,$path); | |
if( count($e_path) > 2 ){ | |
throw new \InvalidArgumentException("Only one instance of '{$marker}' is supported per expression."); | |
} elseif( count($e_path) < 2 ){ | |
return $e_path; | |
} | |
$base_path = $e_path[0]; | |
$sub_path = $e_path[1]; |
[ Launch: reddit base ] e126a3b489d24e0645fa by ababkov[ Launch: reddit base ] 99a41ca041c2ac965c3e by ababkov