12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
-
- require_once(__DIR__ . "/vendor/autoload.php");
-
- $dotenv = new Dotenv\Dotenv(__DIR__);
- $dotenv->load();
-
- header('Content-Type: text/html; charset=iso-8859');
-
-
- $cookie = new \GuzzleHttp\Cookie\SetCookie([
- 'Name' => 'PHPSESSID',
- 'Value' => getenv('SESSION'),
- 'Domain' => 'wprodl.uqac.ca'
- ]);
-
- $jar = new \GuzzleHttp\Cookie\CookieJar(true);
- $jar->setCookie($cookie);
-
- $client = new GuzzleHttp\Client(['cookies' => true]);
-
- $response = $client->request('POST', 'https://wprodl.uqac.ca/dossier_etudiant/grille_horaire.html?type=gl', [
- 'cookies' => $jar,
- 'form_params' => [
- 'session' => getenv('PERIOD')
- ]
- ]);
-
- $body = (string)$response->getBody();
-
- $doc = new DOMDocument();
- $doc->loadHTML($body);
- $xpath = new DOMXpath($doc);
- $div = $xpath->query("//div[@id='partie_centrale']");
- $table = $doc->saveHTML($div[0]);
-
- echo $table;
|