Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('../lib/Requests/library/Requests.php');
- require_once('../lib/simple_html_dom.php');
- Requests::register_autoloader();
- function beginSesion() {
- global $session;
- try {
- $auth = array(
- 'main_login' => '4523023966',
- 'main_password' => '9WQZ',
- 'verify' => false
- );
- $session = new Requests_Session('http://edu.tatar.ru/');
- $session->post('http://edu.tatar.ru/logon', array(), $auth);
- return(true);
- }
- catch(Exception $e) {
- echo $e->getMessage();
- return(false);
- }
- }
- function getHtml($timestamp) {
- global $session;
- global $html;
- try{
- //$timestamp-=10800; //gmt to local
- $request = $session->get('http://edu.tatar.ru/user/diary/day?for='.$timestamp);
- $html=str_get_html($request->body);
- return true;
- }
- catch(Exception $e) {
- echo $e->getMessage();
- return(false);
- }
- }
- function getDay()
- {
- global $html;
- global $marks;
- global $tasks;
- foreach($html->find('table.main tbody tr[style="text-align: center;"]') as $tr)
- {
- $subj = str_replace(" ", "", $tr->find('td', 1)->plaintext);
- $tasks[$subj] = $tr->find('td', 2)->plaintext;
- foreach($tr->find('table.marks td') as $mark)
- {
- $mark = $mark->plaintext;
- $marks[$subj][]=$mark;
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement