adding new method to PageScrapper, adding new page
This commit is contained in:
parent
f8155f2557
commit
05fbca2353
|
@ -29,15 +29,27 @@ class PageScrapper
|
|||
|
||||
public function normalizeURLFile($content)
|
||||
{
|
||||
//$content = preg_replace('/<a href="(.*)"/isU', 'https://mkgtu.ru' ,$content );
|
||||
$rez = preg_match_all('/<a href="(.*)">/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('/<a href="(.*)">/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;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
</div>
|
||||
|
||||
<div class="col-8">
|
||||
<a href="postup-col.php">
|
||||
<a href="{{ route('kolledzh') }}">
|
||||
<h4>
|
||||
<div
|
||||
class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2">
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
@extends('layouts.applicant-layout')
|
||||
@section('content')
|
||||
<div class=" fw-bolder fs-1 text-center py-5 lh-lg"> Для поступающих на обучение по программам среднего профессионального образования </div>
|
||||
<div class="container pt-4 d-flex justify-content-center">
|
||||
|
||||
<div class="col-10">
|
||||
@php
|
||||
use App\Services\PageScrapper;
|
||||
$pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/priemnaya-kampaniya/kolledzh/", '<div class=["\']content_info["\']>');
|
||||
$row = $pageScrapper->getHTML();
|
||||
$content = $pageScrapper->normalizeURLFile($row);
|
||||
$content = $pageScrapper->cutHTML($content,'/<footer(.*)<\/footer>/isU');
|
||||
echo $content;
|
||||
|
||||
@endphp
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
|
@ -1,6 +1,6 @@
|
|||
@extends('layouts.applicant-layout')
|
||||
@section('content')
|
||||
<div class=" fw-bolder fs-1 text-center py-5"> Для поступающих на программы бакалавриата, магистратуры </div>
|
||||
<div class=" fw-bolder fs-1 text-center py-5 lh-lg"> Для поступающих на программы бакалавриата, магистратуры </div>
|
||||
<div class="container pt-4 d-flex justify-content-center">
|
||||
|
||||
<div class="col-10">
|
||||
|
@ -9,14 +9,7 @@
|
|||
$pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/priemnaya-kampaniya/spetsialitet-magistratura-2022/", '<div class=["\']content_info["\']>');
|
||||
$row = $pageScrapper->getHTML();
|
||||
$content = $pageScrapper->normalizeURLFile($row);
|
||||
|
||||
|
||||
|
||||
$page = "https://mkgtu.ru/postuplenie/priemnaya-kampaniya/spetsialitet-magistratura-2022/";
|
||||
$strForScissors = '/<footer(.*)<\/footer>/isU';
|
||||
$tmp = preg_match_all($strForScissors, $content, $arr);
|
||||
$content = str_replace($arr[1],'',$content);
|
||||
|
||||
$content = $pageScrapper->cutHTML($content,'/<footer(.*)<\/footer>/isU');
|
||||
echo $content ;
|
||||
|
||||
@endphp
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@extends('layouts.applicant-layout')
|
||||
@section('content')
|
||||
<div class=" fw-bolder fs-1 text-center py-5"> Веб-консультации для абитуриентов и их родителей </div>
|
||||
<div class=" fw-bolder fs-1 text-center py-5 lh-lg"> Веб-консультации для абитуриентов и их родителей </div>
|
||||
<div class="container pt-4 d-flex justify-content-center">
|
||||
|
||||
<div class="col-10">
|
||||
|
@ -9,10 +9,7 @@
|
|||
$pageScrapper = new PageScrapper("https://www.mkgtu.ru/postuplenie/web-consultations/", '<div class=["\']content_info["\']>');
|
||||
$row = $pageScrapper->getHTML();
|
||||
$content = $pageScrapper->normalizeURLFile($row);
|
||||
$page = "https://mkgtu.ru/postuplenie/priemnaya-kampaniya/spetsialitet-magistratura-2022/";
|
||||
$strForScissors = '/<footer(.*)<\/footer>/isU';
|
||||
$tmp = preg_match_all($strForScissors, $content, $arr);
|
||||
$content = str_replace($arr[1],'',$content);
|
||||
$content = $pageScrapper->cutHTML($content,'/<footer(.*)<\/footer>/isU');
|
||||
echo $content;
|
||||
|
||||
@endphp
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
}
|
||||
</style>
|
||||
|
||||
<div class=" fw-bolder fs-1 text-center py-5"> Подача документов онлайн </div>
|
||||
<div class=" fw-bolder fs-1 text-center py-5 lh-lg"> Подача документов онлайн </div>
|
||||
<div class="container pt-4 d-flex justify-content-center">
|
||||
|
||||
<div class="col-10">
|
||||
|
@ -39,10 +39,7 @@
|
|||
$pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/podat-dokumenty-onlayn/", '<div class=["\']content_info["\']>');
|
||||
$row = $pageScrapper->getHTML();
|
||||
$content = $pageScrapper->normalizeURLFile($row);
|
||||
$page = "https://mkgtu.ru/postuplenie/priemnaya-kampaniya/spetsialitet-magistratura-2022/";
|
||||
$strForScissors = '/<footer(.*)<\/footer>/isU';
|
||||
$tmp = preg_match_all($strForScissors, $content, $arr);
|
||||
$content = str_replace($arr[1],'',$content);
|
||||
$content = $pageScrapper->cutHTML($content,'/<footer(.*)<\/footer>/isU');
|
||||
echo $content;
|
||||
|
||||
@endphp
|
||||
|
|
|
@ -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 () {
|
||||
|
|
Loading…
Reference in New Issue