main #6

Merged
aslan merged 5 commits from RomanGolienko/Roman_applicant-site:main into main 2024-01-23 11:11:01 +03:00
6 changed files with 13 additions and 125 deletions
Showing only changes of commit f65fbda4a7 - Show all commits

View File

@ -15,45 +15,22 @@ class PageScrapper
public function getHTML() public function getHTML()
{ {
// echo($this->url);
// echo($this->contentMarker);
$page = file_get_contents($this->url); $page = file_get_contents($this->url);
Review

Удали все комментарии на этой странице

Удали все комментарии на этой странице
$strForPregMatch = "/" . "{$this->contentMarker}" . "(.*)<\/div>/isU"; $strForPregMatch = "/" . "{$this->contentMarker}" . "(.*)<\/div>/isU";
$arr = []; $arr = [];
$rez = preg_match_all($strForPregMatch, $page, $arr); $rez = preg_match_all($strForPregMatch, $page, $arr);
//echo '<prE>'.print_r($arr[1]).'</pre>';
//$tmp = explode("<br>" , $page);
//$content = $tmp[4].$tmp[5].$tmp[6];
return $content = $arr[1][0].'</div>'; return $content = $arr[1][0].'</div>';
} }
public function normalizeURLFile($content) public function normalizeURLFile($content)
{ {
$rez = preg_match_all('/href="(.*)"/isU',$content,$arr); $rez = preg_match_all('/href="(.*)"/isU',$content,$arr);
//echo '<prE>'.print_r($arr,1).'</pre>';
foreach ($arr[1] as $el) { foreach ($arr[1] as $el) {
//if (strpos($el, '/abitur') !== false) {
if (strpos($el, 'http') !== 0) { if (strpos($el, 'http') !== 0) {
//str_replace('/abitur', 'https://mkgtu.ru/abitur',$el);
$content = str_replace($el,'https://mkgtu.ru'.$el,$content); $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)
return $content; return $content;
} }
} }

View File

@ -24,7 +24,7 @@ return [
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Next, you may define every authentication guard for your application. | Next, you may define every authentication guard for your application.
| Of abitur, a great default configuration has been defined for you | Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider. | here which uses session storage and the Eloquent user provider.
| |
| All authentication drivers have a user provider. This defines how the | All authentication drivers have a user provider. This defines how the

View File

@ -10,7 +10,7 @@ return [
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may specify which of the database connections below you wish | Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of abitur | to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library. | you may use many connections at once using the Database library.
| |
*/ */
@ -23,7 +23,7 @@ return [
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here are each of the database connections setup for your application. | Here are each of the database connections setup for your application.
| Of abitur, examples of configuring each database platform that is | Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple. | supported by Laravel is shown below to make development simple.
| |
| |

View File

@ -80,7 +80,7 @@ return [
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| When using the "database" session driver, you may specify the table we | When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of abitur, a sensible default is | should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed. | provided for you; however, you are free to change this as needed.
| |
*/ */

View File

@ -8,7 +8,7 @@ return [
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Most templating systems load templates from disk. Here you may specify | Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of abitur | an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you. | the usual Laravel view path has already been registered for you.
| |
*/ */

View File

@ -29,109 +29,20 @@
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='16' height='16' xmlns='http://www.w3.org/2000/svg' fill='%230c63e4'%3e%3cg%3e%3ctitle%3eLayer 1%3c/title%3e%3cpath fill='%23396849' fill-rule='evenodd' d='m1.646,4.646a0.5,0.5 0 0 1 0.708,0l5.646,5.647l5.646,-5.647a0.5,0.5 0 0 1 0.708,0.708l-6,6a0.5,0.5 0 0 1 -0.708,0l-6,-6a0.5,0.5 0 0 1 0,-0.708z' id='svg_1'/%3e%3c/g%3e%3c/svg%3e"); background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='16' height='16' xmlns='http://www.w3.org/2000/svg' fill='%230c63e4'%3e%3cg%3e%3ctitle%3eLayer 1%3c/title%3e%3cpath fill='%23396849' fill-rule='evenodd' d='m1.646,4.646a0.5,0.5 0 0 1 0.708,0l5.646,5.647l5.646,-5.647a0.5,0.5 0 0 1 0.708,0.708l-6,6a0.5,0.5 0 0 1 -0.708,0l-6,-6a0.5,0.5 0 0 1 0,-0.708z' id='svg_1'/%3e%3c/g%3e%3c/svg%3e");
} }
</style> </style>
<!-- transform: scale(1.2); -->
<!--<div class="container py-5" id="featured-3">
<br><br><br><br><br>
<h1 class="text-dark col-12 d-flex justify-content-center">Подача документов онлайн с помощью информационных систем МГТУ: <br><br></h1>
<div class="d-flex justify-content-center">
<div class="col-4 px-2 m-3 element-1 " >
<a href="https://portal.mkgtu.ru/" target="_blank">
<span style="color: #005951;">
<h3 class="m-2 fs-2 text-body-emphasis"> По образовательным программам высшего образования </h3>
</span>
</a>
</div>
<div class="col-4 px-2 m-3 element-1">
<a href="https://mkgtu.ru/auth/" target="_blank">
<span style="color: #005951;">
<h3 class="m-2 fs-2 text-body-emphasis">По образовательным программам среднего профессионального образования (колледж)</h3>
</span>
</a>
</div>
</div>
</div>
-->
<!--
<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">
<button class="accordion-button collapsed accordionHover" type="button" data-bs-toggle="collapse"
data-bs-target="#flush-collapseOne" aria-expanded="false" aria-controls="flush-collapseOne">
По образовательным программам высшего образования
</button>
</h2>
<div id="flush-collapseOne" class="accordion-collapse collapse" aria-labelledby="flush-headingOne"
data-bs-parent="#accordionFlushExample">
<div class="accordion-body tp-feature__title">
<br>
<h2><a href="https://portal.mkgtu.ru/" target="_blank">По образовательным программам высшего
образования</a></h2>
<br>
<h3>
<a href="https://mkgtu.ru/abitur/%D0%98%D0%BD%D1%81%D1%82%D1%80%D1%83%D0%BA%D1%86%D0%B8%D1%8F%20%D0%BF%D0%BE%20%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%B5%20%D1%81%20%D0%BB%D0%B8%D1%87%D0%BD%D1%8B%D0%BC%20%D0%BA%D0%B0%D0%B1%D0%B8%D0%BD%D0%B5%D1%82%D0%BE%D0%BC%20%D0%B0%D0%B1%D0%B8%D1%82%D1%83%D1%80%D0%B8%D0%B5%D0%BD%D1%82%D0%B0%202023.pdf"
target="_blank">Инструкция по работе с личным кабинетом абитуриента</a></h3><br>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="flush-headingTwo">
<button class="accordion-button collapsed accordionHover" type="button" data-bs-toggle="collapse"
data-bs-target="#flush-collapseTwo" aria-expanded="false" aria-controls="flush-collapseTwo">
По образовательным программам среднего профессионального образования (колледж)
</button>
</h2>
<div id="flush-collapseTwo" class="accordion-collapse collapse" aria-labelledby="flush-headingTwo"
data-bs-parent="#accordionFlushExample">
<div class="accordion-body tp-feature__title">
<br>
<h2><a href="https://mkgtu.ru/auth/" target="_blank">По&nbsp;образовательным программам среднего
профессионального образования (колледж)</a></h2><br>
<br>
<h3><a href="https://mkgtu.ru/abitur/1.pdf" target="_blank">Инструкция по работе с личным кабинетом
абитуриента</a></h3><br>
</div>
</div>
</div>
</div>
-->
<div class=" fw-bolder fs-1 text-center py-5"> Подача документов онлайн </div> <div class=" fw-bolder fs-1 text-center py-5"> Подача документов онлайн </div>
<div class="container pt-4 d-flex justify-content-center"> <div class="container pt-4 d-flex justify-content-center">
<div class=""><?php <div class="col-10">
$page = file_get_contents("https://mkgtu.ru/postuplenie/podat-dokumenty-onlayn/"); @php
$rez = preg_match_all('/<div class="content_info">(.*)<\/div>/isU',$page,$arr); use App\Services\PageScrapper;
//echo '<prE>'.print_r($arr[1]).'</pre>'; $pageScrapper = new PageScrapper("https://www.mkgtu.ru/postuplenie/web-consultations/", '<div class=["\']content_info["\']>');
$row = $pageScrapper->getHTML();
$content = $pageScrapper->normalizeURLFile($row);
//$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; echo $content;
?>
@endphp
</div> </div>
</div> </div>