<?php
include_once '../../fly2/fly3.php';

$app->action('index', function (&$view) {
	$view = 'index';	
});

$app->action('crolling', function() use($rml){
	$curl = curl_init();
	curl_setopt($curl, CURLOPT_URL, "https://www.naver.com/");
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
	$result = curl_exec($curl);
	$randList = explode("<ul class=\"ah_l\">", $result);
	$randList = explode("</ul>", $randList[1]);
	$rand[0] = explode("<li class=\"ah_item\">", $randList[0]);
	for($i=1; $i<count($rand[0]); $i++){
		$rand[1] = explode("</span>", $rand[0][$i]);
		$keyword = trim(strip_tags($rand[1][1]));
		if($keyword)
			$keywords[] = $keyword;
	}
	reply_json($keywords);
});

$app->action('get_default_keyword', function() {
	$a = $_REQUEST;
	$url = "http://metauis.moddev.kr/MenuApi/getMenuAll?서비스코드=MA01";
	$keywords = file_get_contents($url);
	$menu = json_decode($keywords, true);
	print_r($menu[19878][param1]);
});


?>
