sveden-parser/app/app.php

35 lines
801 B
PHP
Raw Normal View History

2024-08-08 12:32:27 +02:00
<?php
namespace App;
use App\Library\SvedenParser;
use App\Library\Database;
use GuzzleHttp\Client;
$dbconfig = [
"host" => "10.90.1.201",
"database" => "opendata",
"user" => "niimko_user",
"password" => "MOhA17FeboXE"
];
$client = new Client();
$response = $client->get('https://marsu.ru/sveden/education/eduChislen.php');
$html = $response->getBody()->getContents();
$parser = new SvedenParser($html, '//tr[@itemprop="eduChislen"]//');
$data = $parser->getDataTable();
$db = new Database(
"mysql:host={$dbconfig['host']};dbname={$dbconfig['database']}",
$dbconfig['user'],
$dbconfig['password']
);
// print_r($data);
// $db->insert('sveden_table_education', $data);
$data = $db->select('sveden_education_contingent');
echo "<pre>";
print_r($data);
echo "</pre>";