diff --git a/app/Services/PageScrapper.php b/app/Services/PageScrapper.php index 7a2b7aa..f52aabe 100644 --- a/app/Services/PageScrapper.php +++ b/app/Services/PageScrapper.php @@ -15,21 +15,42 @@ class PageScrapper public function getHTML() { + $page = file_get_contents($this->url); - $strForPregMatch = "/" . "{$this->contentMarker}" . "(.*)<\/div>/isU"; + $strForPregMatch = "/" . "{$this->contentMarker}" . "(.*)<\/div>/is"; + $arr = []; $rez = preg_match_all($strForPregMatch, $page, $arr); - return $content = $arr[1][0] . ''; + + return $content = $arr[1][0]; + + } public function normalizeURLFile($content) { - $rez = preg_match_all('/href="(.*)"/isU', $content, $arr); + + $rez = preg_match_all('//isU',$content,$arr); + $arr[1] = array_unique($arr[1]); foreach ($arr[1] as $el) { - if (strpos($el, 'http') !== 0) { - $content = str_replace($el, 'https://mkgtu.ru' . $el, $content); + 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/home.blade.php b/resources/views/home.blade.php index 6547279..51c2bf5 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -26,7 +26,7 @@
- +
diff --git a/resources/views/menu/abitur.blade.php b/resources/views/menu/abitur.blade.php index f319136..05dc9f7 100644 --- a/resources/views/menu/abitur.blade.php +++ b/resources/views/menu/abitur.blade.php @@ -38,7 +38,7 @@
- +

@@ -49,7 +49,7 @@
- +

@@ -60,7 +60,7 @@
- +

@@ -71,7 +71,7 @@
- +

@@ -82,7 +82,7 @@
- +

@@ -93,7 +93,7 @@
- +

@@ -104,7 +104,7 @@
- +

@@ -115,7 +115,7 @@
- +

diff --git a/resources/views/menu/abitur/aspirantura.blade.php b/resources/views/menu/abitur/aspirantura.blade.php new file mode 100644 index 0000000..aaf63ec --- /dev/null +++ b/resources/views/menu/abitur/aspirantura.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/aspirantura/", '
'); + $row = $pageScrapper->getHTML(); + $content = $pageScrapper->normalizeURLFile($row); + $content = $pageScrapper->cutHTML($content,'//isU'); + echo $content; + + @endphp + +
+
+@endsection 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/ordinatura.blade.php b/resources/views/menu/abitur/ordinatura.blade.php new file mode 100644 index 0000000..62e14da --- /dev/null +++ b/resources/views/menu/abitur/ordinatura.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/ordinatura/", '
'); + $row = $pageScrapper->getHTML(); + $content = $pageScrapper->normalizeURLFile($row); + $content = $pageScrapper->cutHTML($content,'//isU'); + echo $content; + + @endphp + +
+
+@endsection diff --git a/resources/views/menu/abitur/platnye-obrazovatelnye-uslugi.blade.php b/resources/views/menu/abitur/platnye-obrazovatelnye-uslugi.blade.php new file mode 100644 index 0000000..786c3ad --- /dev/null +++ b/resources/views/menu/abitur/platnye-obrazovatelnye-uslugi.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/platnye-obrazovatelnye-uslugi/", '
'); + $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 new file mode 100644 index 0000000..289827f --- /dev/null +++ b/resources/views/menu/abitur/spetsialitet-magistratura.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/spetsialitet-magistratura-2022/", '
'); + $row = $pageScrapper->getHTML(); + $content = $pageScrapper->normalizeURLFile($row); + $content = $pageScrapper->cutHTML($content,'//isU'); + echo $content ; + + @endphp + +
+
+@endsection diff --git a/resources/views/menu/abitur/videomaterialy-dlya-postupayushchikh.blade.php b/resources/views/menu/abitur/videomaterialy-dlya-postupayushchikh.blade.php new file mode 100644 index 0000000..cd0f407 --- /dev/null +++ b/resources/views/menu/abitur/videomaterialy-dlya-postupayushchikh.blade.php @@ -0,0 +1,25 @@ +@extends('layouts.applicant-layout') +@section('content') +
Видеоматериалы для поступающих
+
+ +
+ @php + use App\Services\PageScrapper; + $pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/priemnaya-kampaniya/videomaterialy-dlya-postupayushchikh/", '
'); + $row = $pageScrapper->getHTML(); + $content = $pageScrapper->normalizeURLFile($row); + $content = $pageScrapper->cutHTML($content,'//isU'); + + $content = str_replace( + 'Обложка Госуслуги_page-0001.jpg', + 'Обложка Госуслуги_page-0001.jpg', + $content); + echo $content; + + @endphp + +
+
+@endsection + diff --git a/resources/views/menu/abitur/web-consultations.blade.php b/resources/views/menu/abitur/web-consultations.blade.php index efaa0a8..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,6 +9,7 @@ $pageScrapper = new PageScrapper("https://www.mkgtu.ru/postuplenie/web-consultations/", '
'); $row = $pageScrapper->getHTML(); $content = $pageScrapper->normalizeURLFile($row); + $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 05fdcd0..df990a3 100644 --- a/resources/views/menu/course.blade.php +++ b/resources/views/menu/course.blade.php @@ -30,15 +30,16 @@ } -
Подача документов онлайн
+
Подача документов онлайн
@php use App\Services\PageScrapper; - $pageScrapper = new PageScrapper("https://www.mkgtu.ru/postuplenie/web-consultations/", '
'); + $pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/podat-dokumenty-onlayn/", '
'); $row = $pageScrapper->getHTML(); $content = $pageScrapper->normalizeURLFile($row); + $content = $pageScrapper->cutHTML($content,'//isU'); echo $content; @endphp diff --git a/routes/web.php b/routes/web.php index 4bd67c4..ae771ca 100644 --- a/routes/web.php +++ b/routes/web.php @@ -30,14 +30,38 @@ Route::get('/course', function () { return view('menu.course'); })->name('course'); -Route::get('/abitur', function () { +Route::get('/applicant', function () { return view('menu.abitur'); -})->name('applicant'); +})->name('abitur'); Route::get('/web-consultations', function () { return view('menu.abitur.web-consultations'); })->name('web-consultations'); +Route::get('/specialty-magistracy', function () { + return view('menu.abitur.spetsialitet-magistratura'); +})->name('spetsialitet-magistratura'); + +Route::get('/college', function () { + return view('menu.abitur.kolledzh'); +})->name('kolledzh'); + +Route::get('/paid-educational-services', function () { + return view('menu.abitur.platnye-obrazovatelnye-uslugi'); +})->name('platnye-obrazovatelnye-uslugi'); + +Route::get('/residency', function () { + return view('menu.abitur.ordinatura'); +})->name('ordinatura'); + +Route::get('/traineeship', function () { + return view('menu.abitur.aspirantura'); +})->name('aspirantura'); + +Route::get('/video-materials-for-applicants', function () { + return view('menu.abitur.videomaterialy-dlya-postupayushchikh'); +})->name('videomaterialy-dlya-postupayushchikh'); + Route::post('/uploadfile', [UploadFileController::class, 'showUploadFile'])->name('uploadfile'); Route::get('/dashboard', function () {