adding new page
This commit is contained in:
parent
f65fbda4a7
commit
bfcb9cdba2
|
@ -15,22 +15,29 @@ class PageScrapper
|
||||||
|
|
||||||
public function getHTML()
|
public function getHTML()
|
||||||
{
|
{
|
||||||
|
|
||||||
$page = file_get_contents($this->url);
|
$page = file_get_contents($this->url);
|
||||||
$strForPregMatch = "/" . "{$this->contentMarker}" . "(.*)<\/div>/isU";
|
$strForPregMatch = "/" . "{$this->contentMarker}" . "(.*)<\/div>/is";
|
||||||
|
|
||||||
$arr = [];
|
$arr = [];
|
||||||
$rez = preg_match_all($strForPregMatch, $page, $arr);
|
$rez = preg_match_all($strForPregMatch, $page, $arr);
|
||||||
return $content = $arr[1][0].'</div>';
|
|
||||||
|
return $content = $arr[1][0];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function normalizeURLFile($content)
|
public function normalizeURLFile($content)
|
||||||
{
|
{
|
||||||
$rez = preg_match_all('/href="(.*)"/isU',$content,$arr);
|
//$content = preg_replace('/<a href="(.*)"/isU', 'https://mkgtu.ru' ,$content );
|
||||||
|
$rez = preg_match_all('/<a href="(.*)">/isU',$content,$arr);
|
||||||
foreach ($arr[1] as $el) {
|
foreach ($arr[1] as $el) {
|
||||||
if (strpos($el, 'http') !== 0) {
|
if (!str_contains($el, 'https://')){
|
||||||
$content = str_replace($el,'https://mkgtu.ru' . $el,$content);
|
$content = str_replace($el,'https://mkgtu.ru' . $el,$content);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $content;
|
return $content;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<a href="postup.php">
|
<a href="{{ route('spetsialitet-magistratura') }}">
|
||||||
<h4>
|
<h4>
|
||||||
<div
|
<div
|
||||||
class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2">
|
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,26 @@
|
||||||
|
@extends('layouts.applicant-layout')
|
||||||
|
@section('content')
|
||||||
|
<div class=" fw-bolder fs-1 text-center py-5"> Для поступающих на программы бакалавриата, магистратуры </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/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);
|
||||||
|
|
||||||
|
echo $content ;
|
||||||
|
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
|
@ -36,7 +36,7 @@
|
||||||
<div class="col-10">
|
<div class="col-10">
|
||||||
@php
|
@php
|
||||||
use App\Services\PageScrapper;
|
use App\Services\PageScrapper;
|
||||||
$pageScrapper = new PageScrapper("https://www.mkgtu.ru/postuplenie/web-consultations/", '<div class=["\']content_info["\']>');
|
$pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/podat-dokumenty-onlayn/", '<div class=["\']content_info["\']>');
|
||||||
$row = $pageScrapper->getHTML();
|
$row = $pageScrapper->getHTML();
|
||||||
$content = $pageScrapper->normalizeURLFile($row);
|
$content = $pageScrapper->normalizeURLFile($row);
|
||||||
echo $content;
|
echo $content;
|
||||||
|
|
|
@ -38,6 +38,10 @@ Route::get('/web-consultations', function () {
|
||||||
return view('menu.abitur.web-consultations');
|
return view('menu.abitur.web-consultations');
|
||||||
})->name('web-consultations');
|
})->name('web-consultations');
|
||||||
|
|
||||||
|
Route::get('/spetsialitet-magistratura', function () {
|
||||||
|
return view('menu.abitur.spetsialitet-magistratura');
|
||||||
|
})->name('spetsialitet-magistratura');
|
||||||
|
|
||||||
Route::post('/uploadfile', [UploadFileController::class, 'showUploadFile'])->name('uploadfile');
|
Route::post('/uploadfile', [UploadFileController::class, 'showUploadFile'])->name('uploadfile');
|
||||||
|
|
||||||
Route::get('/dashboard', function () {
|
Route::get('/dashboard', function () {
|
||||||
|
|
Loading…
Reference in New Issue