Skip to content

Instantly share code, notes, and snippets.

@GaryJones
Created August 18, 2016 14:11
Show Gist options
  • Save GaryJones/88eed7a60c6196b7ff0e2f744c2ff6ad to your computer and use it in GitHub Desktop.
Save GaryJones/88eed7a60c6196b7ff0e2f744c2ff6ad to your computer and use it in GitHub Desktop.
WASDE XML BOM checker
<?php
/*
* = Instructions =
* Save locally as xml-bom.php
* Then in terminal, `cd` to the correct folder, and run:
* php xml-bom.php
*/
$xml = file_get_contents('http://www.usda.gov/oce/commodity/wasde/latest.xml');
define('BOM', "\xEF\xBB\xBF");
if (false !== strpos($xml, BOM) ) {
echo 'XML file contains BOM.' . PHP_EOL;
} else {
echo 'XML file does not contain BOM' . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment