$value) { if (preg_match('/attr/',$key)) { $regions[$value["cd"]] = $value["name"]; } } return $regions; } /** * returns array of prefectures under the specified region. * * @param string $region_id * @return array of prefectures */ public function get_prefectures($region_id) { if ($region_id == "01") { return array("010000" => "北海道"); } else if ($region_id == "55") { return array("470000" => "沖縄県"); } $xml_segment = &parent::get_xml_segment( JALAN_AREA_SEARCH_URL . "?key=" . JALAN_API_KEY . "®=" . $region_id, array("Results","Area","Region","Prefecture") ); $prefectures = array(); foreach ($xml_segment as $key => $value) { if (preg_match('/attr/',$key)) { $prefectures[$value["cd"]] = $value["name"]; } } return $prefectures; } /** * returns the array of large areas under the specified region * * @param $prefecture_id prefecture ID or (in hokkaido,okinawa's cases, region id) * @return array of large areas */ public function get_large_areas($prefecture_id) { $xml_segment = &parent::get_xml_segment( JALAN_AREA_SEARCH_URL . "?key=" . JALAN_API_KEY . "&pref=" . $prefecture_id, array("Results","Area","Region","Prefecture","LargeArea") ); $large_areas = array(); foreach ($xml_segment as $key => $value) { if (preg_match('/attr/',$key)) { $large_areas[$value["cd"]] = $value["name"]; } } return $large_areas; } } ?>