module_category_srl=='2221114') continue; // except timeline; if( !sizeof($category->data) ) continue; ?>
data as $key=>$val){ //( in_array($val->module_srl, $args->module_srls) ) ? $checked=" checked" : $checked = " "; ( $val->module_srl==$args->module_srl ) ? $checked=" checked" : $checked = " "; echo "".$val->browser_title." "; if($cnt%6==5) echo "
"; $cnt++; } ?>
data as $key=>$val){ $query = "select * from xe_aa_search_keyword where module_srl=".$val->module_srl; $temp = rows_dev($query); foreach($temp as $k=>$v){ echo "".$v->search_keyword." "; } } ?>
검색어
API Key TEST
search_keyword){ echo "키워드를 입력해주세요"; exit; } if(!$args->module_srl){ echo "게시판을 선택해주세요"; exit; } //현재이용가능한 Youtube Key 가져오기 if(!$args->apiKey) $apiKey = fn_get_youtube_key(); else $apiKey = $args->apiKey; //검색한 것을 DB에 입력 $query = "insert into xe_aa_search_keyword set search_keyword='".addslashes($args->search_keyword)."', module_srl=".$args->module_srl; $oDB->_query($query); $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $url = 'https://www.googleapis.com/youtube/v3/search?part=snippet&q=' . urlencode($args->search_keyword) . '&maxResults=' . MAX_RESULTS . '&key=' . $apiKey; curl_setopt($ch, CURLOPT_URL, $url); $data = json_decode(curl_exec($ch)); if($args->apiKey){ print_r($data); exit; } //echo $data->error->code; //error if( $data->error->code ){ fn_youtube_error_check_log($apiKey, $data); $apiKey = fn_get_youtube_key(); echo $apiKey; $url = 'https://www.googleapis.com/youtube/v3/search?part=snippet&q=' . urlencode($args->search_keyword) . '&maxResults=' . MAX_RESULTS . '&key=' . $apiKey; curl_setopt($ch, CURLOPT_URL, $url); $data = json_decode(curl_exec($ch), true); //print_r($data); } $result_arr = $data->items; $cnt=1; while(isset($data->nextPageToken)){ $nextUrl = $url . '&pageToken=' . $data->nextPageToken; curl_setopt($ch, CURLOPT_URL, $nextUrl); $data = json_decode(curl_exec($ch)); //error if( $data->error->code ){ fn_youtube_error_check_log($apiKey, $data); $apiKey = fn_get_youtube_key(); $data = json_decode(curl_exec($ch), true); } //print_r($data); $result_arr = array_merge($result_arr, $data->items); if($cnt==10) break; $cnt++; } //print_r($result_arr); $str = "
"; $str .= ""; foreach($result_arr as $k=>$v){ //print_r($v->id->videoId); /* $str.=""; $str.=""; $str.=""; $str.=""; */ $str.=""; //등록하기 $videoId = $v->id->videoId; $channelTitle = $v->snippet->channelTitle; $channelId = $v->snippet->channelId; $title = $v->snippet->title; $description = $v->snippet->description; $thumbnail = $v->snippet->thumbnails->high->url; $regdate = date("YmdHis",strtotime($v->snippet->publishedAt)); $content = '
'; $content .= "

".$description."

"; if(!$videoId) continue; if(!trim($title)) continue; $obj = new stdClass; $user_id = $channelId; $query = "select * from xe_member where user_id='".$user_id."'"; $temp = rows_dev($query); if($temp){ $obj->nick_name = $temp[0]->nick_name; $obj->member_srl = $temp[0]->member_srl; }else{ $member_srl = $oDB->getNextSequence(); $list_order = -1 * $member_srl; $user_id = $channelId; $password = "qwe123"; $email_id = uniqid(); $email_host = "ktube.info"; $email_address = $email_id."@".$email_host; $user_name = $channelTitle; $nick_name = $channelTitle; /* $query = "insert into xe_member (`member_srl`, `user_id`, `email_address`, `password`, `email_id`, `email_host`, `user_name`, `nick_name`, `find_account_question`, `find_account_answer`, `homepage`, `blog`, `birthday`, `allow_mailing`, `allow_message`, `denied`, `limit_date`, `regdate`, `last_login`, `change_password_date`, `is_admin`, `description`, `extra_vars`, `list_order`) values (".$member_srl.", '".$user_id."', '".$email_address."', '".$password."', '".$email_id."', '".$email_host."', '".$user_name."', '".$nick_name."', 0, 'find_account_answer', '', '', '', 'N', 'Y', 'N', '', '".date("Ymdhis")."', '".date("Ymdhis")."', '".date("Ymdhis")."', 'N', '', '".$extra_vars."', ".$list_order.")"; exec_dev($query); $query = "insert into xe_member_group_member set site_srl=0, group_srl=3, member_srl=".$member_srl.", regdate='".date("YmdHis"); exec_dev($query); */ $obj->nick_name = $nick_name; $obj->member_srl = $member_srl; } $obj->title = $title." "; $obj->content = $content; $obj->comment_status = "ALLOW"; $obj->channelId = $channelId; $obj->videoId = $videoId; $obj->tags = $keyword; $regdate = date("YmdHis"); $obj->regdate = $regdate; //print_r($obj); if($_GET['module_srl']){ $obj->module_srl = $_GET['module_srl']; }else{ $obj->module_srl = "68"; } $query = "select * from xe_documents where videoId='".$videoId."'"; //echo $query; $temp = rows($query); if(!$temp){ $bAnonymous = true; $obj->document_srl = getNextSequence(); $output = $oDocumentController->insertDocument($obj, $bAnonymous); //print_r($output); if( $output->variables['document_srl'] ){ //$query = "update xe_documents set content='".addslashes($content)."', regdate='".$regdate."' where document_srl=".$output->variables['document_srl']; $query = "update xe_documents set content='".addslashes($content)."' where document_srl=".$output->variables['document_srl']; exec_dev($query); } } //등록하기 } $str .= "
".$v->id->videoId."
".$v->snippet->title."
".$v->snippet->description."
".date("Y-m-d H:i:s",strtotime($v->snippet->publishedAt))."
"; $str .="
"; echo $str; //end curl_close($ch); fn_delete_untitled(); ?>