/** frame. it takes an URL as an argument */ function _parseparltrack($url) { // Parse the parltrack URL $json = ""; $parltrack = fopen("{$url}", "r"); while (($line = fgets($parltrack)) !== False) { $json .= $line; } $parl_mep = json_decode($json, true); foreach ($parl_mep["Mail"] as $mail) { $mep["mail"][] = $mail; } $mep["stb"] = str_replace(' ', '', $parl_mep["Addresses"]["Strasbourg"]["Phone"]); $mep["bxl"] = str_replace(' ', '', $parl_mep["Addresses"]["Strasbourg"]["Phone"]); $mep["group"] = $parl_mep["Groups"][0]["groupid"]; $mep["name"] = $parl_mep["Name"]["full"]; $mep["url"] = $parl_mep["Homepage"]; $mep["country"] = countryCodes($parl_mep["Constituencies"][0]["country"]); $mep["party"] = $parl_mep["Constituencies"][0]["party"]; foreach ($parl_mep["Committees"] as $committee) { $mep["committee"][] = $committee["abbr"]; } $mep["picurl"] = $parl_mep["Photo"]; //FIXME Green party is Verts in parltrack and Green in memopol if (strcmp($mep["group"], "Verts/ALE") == 0) { $mep["group"] = "Greens/EFA"; } $meta = @serialize($mep); fclose($parltrack); return $meta; }
/** * Fetch the array of iso country codes => country names * @return array */ public static function getCountries() { require_once dirname(__FILE__) . '/../gateway_forms/includes/countryCodes.inc'; return countryCodes(); }