Разбил на классы
This commit is contained in:
35
app/app.php
Normal file
35
app/app.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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>";
|
Reference in New Issue
Block a user