diff --git a/app/Services/PageScrapper.php b/app/Services/PageScrapper.php index 20e0e33..7c00dc6 100644 --- a/app/Services/PageScrapper.php +++ b/app/Services/PageScrapper.php @@ -29,15 +29,27 @@ class PageScrapper public function normalizeURLFile($content) { - //$content = preg_replace('//isU',$content,$arr); - foreach ($arr[1] as $el) { - if (!str_contains($el, 'https://')){ - $content = str_replace($el,'https://mkgtu.ru' . $el,$content); + $rez = preg_match_all('//isU',$content,$arr); + $arr[1] = array_unique($arr[1]); + foreach ($arr[1] as $el) { + if (!str_starts_with($el, 'https')){ + $content = str_replace($el,'https://mkgtu.ru' . $el,$content); } } return $content; + } + public function cutHTML($content,$strForScissors) + { + + + $arr = []; + $rez = preg_match_all($strForScissors, $content, $arr); + $content = str_replace($arr[1],'',$content); + + return $content; + + } } diff --git a/resources/views/menu/abitur.blade.php b/resources/views/menu/abitur.blade.php index 461dfee..6b8f89c 100644 --- a/resources/views/menu/abitur.blade.php +++ b/resources/views/menu/abitur.blade.php @@ -49,7 +49,7 @@
- +

diff --git a/resources/views/menu/abitur/kolledzh.blade.php b/resources/views/menu/abitur/kolledzh.blade.php new file mode 100644 index 0000000..6d5abe4 --- /dev/null +++ b/resources/views/menu/abitur/kolledzh.blade.php @@ -0,0 +1,19 @@ +@extends('layouts.applicant-layout') +@section('content') +
Для поступающих на обучение по программам среднего профессионального образования
+
+ +
+ @php + use App\Services\PageScrapper; + $pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/priemnaya-kampaniya/kolledzh/", '
'); + $row = $pageScrapper->getHTML(); + $content = $pageScrapper->normalizeURLFile($row); + $content = $pageScrapper->cutHTML($content,'//isU'); + echo $content; + + @endphp + +
+
+@endsection diff --git a/resources/views/menu/abitur/spetsialitet-magistratura.blade.php b/resources/views/menu/abitur/spetsialitet-magistratura.blade.php index 9431d51..289827f 100644 --- a/resources/views/menu/abitur/spetsialitet-magistratura.blade.php +++ b/resources/views/menu/abitur/spetsialitet-magistratura.blade.php @@ -1,6 +1,6 @@ @extends('layouts.applicant-layout') @section('content') -
Для поступающих на программы бакалавриата, магистратуры
+
Для поступающих на программы бакалавриата, магистратуры
@@ -9,14 +9,7 @@ $pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/priemnaya-kampaniya/spetsialitet-magistratura-2022/", '
'); $row = $pageScrapper->getHTML(); $content = $pageScrapper->normalizeURLFile($row); - - - - $page = "https://mkgtu.ru/postuplenie/priemnaya-kampaniya/spetsialitet-magistratura-2022/"; - $strForScissors = '//isU'; - $tmp = preg_match_all($strForScissors, $content, $arr); - $content = str_replace($arr[1],'',$content); - + $content = $pageScrapper->cutHTML($content,'//isU'); echo $content ; @endphp diff --git a/resources/views/menu/abitur/web-consultations.blade.php b/resources/views/menu/abitur/web-consultations.blade.php index 2365629..bffdc34 100644 --- a/resources/views/menu/abitur/web-consultations.blade.php +++ b/resources/views/menu/abitur/web-consultations.blade.php @@ -1,6 +1,6 @@ @extends('layouts.applicant-layout') @section('content') -
Веб-консультации для абитуриентов и их родителей
+
Веб-консультации для абитуриентов и их родителей
@@ -9,10 +9,7 @@ $pageScrapper = new PageScrapper("https://www.mkgtu.ru/postuplenie/web-consultations/", '
'); $row = $pageScrapper->getHTML(); $content = $pageScrapper->normalizeURLFile($row); - $page = "https://mkgtu.ru/postuplenie/priemnaya-kampaniya/spetsialitet-magistratura-2022/"; - $strForScissors = '//isU'; - $tmp = preg_match_all($strForScissors, $content, $arr); - $content = str_replace($arr[1],'',$content); + $content = $pageScrapper->cutHTML($content,'//isU'); echo $content; @endphp diff --git a/resources/views/menu/course.blade.php b/resources/views/menu/course.blade.php index 9fa261d..df990a3 100644 --- a/resources/views/menu/course.blade.php +++ b/resources/views/menu/course.blade.php @@ -30,7 +30,7 @@ } -
Подача документов онлайн
+
Подача документов онлайн
@@ -39,10 +39,7 @@ $pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/podat-dokumenty-onlayn/", '
'); $row = $pageScrapper->getHTML(); $content = $pageScrapper->normalizeURLFile($row); - $page = "https://mkgtu.ru/postuplenie/priemnaya-kampaniya/spetsialitet-magistratura-2022/"; - $strForScissors = '//isU'; - $tmp = preg_match_all($strForScissors, $content, $arr); - $content = str_replace($arr[1],'',$content); + $content = $pageScrapper->cutHTML($content,'//isU'); echo $content; @endphp diff --git a/routes/web.php b/routes/web.php index 84b05f6..12e2918 100644 --- a/routes/web.php +++ b/routes/web.php @@ -42,6 +42,10 @@ Route::get('/spetsialitet-magistratura', function () { return view('menu.abitur.spetsialitet-magistratura'); })->name('spetsialitet-magistratura'); +Route::get('/kolledzh', function () { + return view('menu.abitur.kolledzh'); +})->name('kolledzh'); + Route::post('/uploadfile', [UploadFileController::class, 'showUploadFile'])->name('uploadfile'); Route::get('/dashboard', function () {