Skip to content

Instantly share code, notes, and snippets.

@Xymanek
Created June 13, 2016 11:36
Show Gist options
  • Save Xymanek/781aaf87fa9cbae73a7a89da87bad72e to your computer and use it in GitHub Desktop.
Save Xymanek/781aaf87fa9cbae73a7a89da87bad72e to your computer and use it in GitHub Desktop.
Processing feeds from NY
JSON error: No error
Processing feeds from MD
JSON error: Syntax error
<?php
function eol ($str = '')
{
return $str . PHP_EOL;
}
$feeds = [
"NY" => "https://gist.githubusercontent.com/kuanb/dbe19ce4e8ef317ee3fc/raw/8dd002cc26f7076eed84f0104bbc70eb1117b9f9/traffic-cameras.json",
'MD' => "https://gist.githubusercontent.com/alexwpotter/e222e644018e696ba8b60d35d285776a/raw/fa8866386c9e36f23a2153ea6e87e9b001d36c35/MDtraffic.json"
];
foreach ($feeds as $key => $feed) {
echo eol('Processing feeds from '. $key);
$str = file_get_contents($feed);
json_decode($str, true);
echo eol('JSON error: ' . json_last_error_msg());
echo eol();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment