Automation/app/Controllers/CLI/Crawler.php
2024-09-05 00:09:04 +09:00

29 lines
1014 B
PHP

<?php
namespace App\Controllers\CLI;
use App\Controllers\BaseController;
use App\Libraries\YamapLibrary;
class Crawler extends BaseController
{
public function yamap(...$params): bool
{
try {
$isDebug = in_array("debug", $params);
//1. Yamap 사이트에서에서 자유게시판의 게시물 중 작성자가 관리자가 아닌 게시물 검색후
// 리스트중 1번째것의 게시물 내용에 있는 이미지,비디오 정보를 가져오게 하는 기능
$library = new YamapLibrary(getenv("yamap.host"));
$library->setDebug($isDebug);
$library->execute();
//2. 워드프레스에 로그인 처리 기능
//3. 워드프레스의 자유게시판에 게시물 등록 기능
log_message("info", "완료되었습니다.");
return true;
} catch (\Exception $e) {
log_message("error", $e->getMessage());
return false;
}
}
}