scraping data from mkgtu and making new pages

This commit is contained in:
Holiienko Roman 2024-01-22 15:31:39 +03:00
parent 00d8e51be0
commit 195561c2eb
5 changed files with 78 additions and 3 deletions

View File

@ -26,7 +26,7 @@
</a>
</div>
<div class="col-lg-3 col-md-4">
<a href="#">
<a href="{{ route('applicant') }}">
<div class="tp-feature__item before-color-2 mb-40">
<div class="tp-feature__icon">
<img style="max-width: 26%;" src="{{ URL::to('img/courses/abit.png') }}" alt="">

View File

@ -16,7 +16,7 @@
<div class="container mt-4">
<div class="row d-flex justify-content-center align-items-center">
<div class="col-8">
<a href="web-consultations.php">
<a href="{{ route('web-consultations') }}">
<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">
@ -127,4 +127,5 @@
</div>
</div>
@endsection

View File

@ -58,7 +58,7 @@
<!--
<div class="pt-4 container justify-content-md-center col-6 accordion accordion-flush" id="accordionFlushExample">
<div class="accordion-item">
<h2 class="accordion-header" id="flush-headingOne">
@ -100,5 +100,39 @@
</div>
</div>
</div>
-->
<div class=" fw-bolder fs-1 text-center py-5"> Подача документов онлайн </div>
<div class="container pt-4 d-flex justify-content-center">
<div class=""><?php
$page = file_get_contents("https://mkgtu.ru/postuplenie/podat-dokumenty-onlayn/");
$rez = preg_match_all('/<div class="content_info">(.*)<\/div>/isU',$page,$arr);
//echo '<prE>'.print_r($arr[1]).'</pre>';
//$tmp = explode("<br>" , $page);
//$content = $tmp[4].$tmp[5].$tmp[6];
$content = $arr[1][0].'</div>';
$rez = preg_match_all('/href="(.*)"/isU',$content,$arr);
//echo '<prE>'.print_r($arr,1).'</pre>';
foreach ($arr[1] as $el) {
//if (strpos($el, '/abitur') !== false) {
if (strpos($el, 'http') !== 0) {
//str_replace('/abitur', 'https://mkgtu.ru/abitur',$el);
$content = str_replace($el,'https://mkgtu.ru'.$el,$content);
}
}
//$content = $arr[1][0].'</div>';
//$content = preg_replace('/href="(?!http|#)/is', 'https:\/\/mkgtu.ru', $content, -1, $count);
//$content = str_replace('href="','href="https://mkgtu.ru',$content);
//$pos = strripos($content,'/abitur');
//echo substr_replace($content, 'https://mkgtu.ru',$pos,0)
echo $content;
?>
</div>
</div>
@endsection

View File

@ -0,0 +1,36 @@
@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
$page = file_get_contents("https://www.mkgtu.ru/postuplenie/web-consultations/");
$rez = preg_match_all('/<div class="content_info">(.*)<\/div>/isU',$page,$arr);
//echo '<prE>'.print_r($arr[1]).'</pre>';
//$tmp = explode("<br>" , $page);
//$content = $tmp[4].$tmp[5].$tmp[6];
$content = $arr[1][0].'</div>';
$rez = preg_match_all('/href="(.*)"/isU',$content,$arr);
//echo '<prE>'.print_r($arr,1).'</pre>';
foreach ($arr[1] as $el) {
//if (strpos($el, '/abitur') !== false) {
if (strpos($el, 'http') !== 0) {
//str_replace('/abitur', 'https://mkgtu.ru/abitur',$el);
$content = str_replace($el,'https://mkgtu.ru'.$el,$content);
}
}
//$content = $arr[1][0].'</div>';
//$content = preg_replace('/href="(?!http|#)/is', 'https:\/\/mkgtu.ru', $content, -1, $count);
//$content = str_replace('href="','href="https://mkgtu.ru',$content);
//$pos = strripos($content,'/abitur');
//echo substr_replace($content, 'https://mkgtu.ru',$pos,0)
echo $content;
?>
</div>
</div>
@endsection

View File

@ -34,6 +34,10 @@ Route::get('/abitur', function () {
return view('pages.abitur');
})->name('applicant');
Route::get('/web-consultations', function () {
return view('pages.web-consultations');
})->name('web-consultations');
Route::post('/uploadfile', [UploadFileController::class, 'showUploadFile'])->name('uploadfile');
Route::get('/dashboard', function () {