Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

index.php 858B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. require_once(__DIR__ . "/vendor/autoload.php");
  3. $dotenv = new Dotenv\Dotenv(__DIR__);
  4. $dotenv->load();
  5. header('Content-Type: text/html; charset=iso-8859');
  6. $cookie = new \GuzzleHttp\Cookie\SetCookie([
  7. 'Name' => 'PHPSESSID',
  8. 'Value' => getenv('SESSION'),
  9. 'Domain' => 'wprodl.uqac.ca'
  10. ]);
  11. $jar = new \GuzzleHttp\Cookie\CookieJar(true);
  12. $jar->setCookie($cookie);
  13. $client = new GuzzleHttp\Client(['cookies' => true]);
  14. $response = $client->request('POST', 'https://wprodl.uqac.ca/dossier_etudiant/grille_horaire.html?type=gl', [
  15. 'cookies' => $jar,
  16. 'form_params' => [
  17. 'session' => getenv('PERIOD')
  18. ]
  19. ]);
  20. $body = (string)$response->getBody();
  21. $doc = new DOMDocument();
  22. $doc->loadHTML($body);
  23. $xpath = new DOMXpath($doc);
  24. $div = $xpath->query("//div[@id='partie_centrale']");
  25. $table = $doc->saveHTML($div[0]);
  26. echo $table;