Exemple #1
0
<?php

include_once "classes/API/RutrackerAPI.php";
include_once "classes/API/RutorAPI.php";
include "ConfigReader.php";
include_once "classes/Utils.php";
$c = new ConfigReader();
$config = $c->getConfig();
$rt = new RutrackerAPI();
$rt->init_action($config['rutracker']['username'], $config['rutracker']['password']);
$rt->parse_user_params();
$flist = $rt->getFutureList();
$rutor = new RutorAPI();
$rt_result = $rutor_search = [];
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Rtracker search
        <?php 
if (isset($_GET['search'])) {
    echo " - " . trim($_GET['search']);
}
?>
    </title>

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
Exemple #2
0
<?php

/**
 * Created by #ROOT.
 * to contact me use skype neronmoon
 */
include_once 'Rutracker.php';
$r = new RutrackerAPI('<login>', '<pass>');
$r->findUser('<login>');
$r->search(["term" => "<term>"]);
Exemple #3
0
<?php

include_once "classes/API/RutrackerAPI.php";
include_once "classes/API/RutorAPI.php";
include "ConfigReader.php";
include_once "classes/Utils.php";
$c = new ConfigReader();
$config = $c->getConfig();
$rt = new RutrackerAPI();
$rt->parse_user_params();
$flist = $rt->getFutureList();
$response = false;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $c->save_param('rutracker', 'username', $_POST['rutracker-username'], false);
    $c->save_param('rutracker', 'password', $_POST['rutracker-password'], false);
    $c->save_param('search-in', 'rutracker', isset($_POST['search-in-rutracker']), false);
    $c->save_param('search-in', 'rutor', isset($_POST['search-in-rutor']), false);
    $response = $c->save_config_to_file();
    $config = $c->getConfig();
}
?>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Rtracker - Config page</title>

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
Exemple #4
0
<?php

//ini_set('display_errors', 1);
//ini_set('display_startup_errors', 1);
//error_reporting(E_ALL );
include_once "classes/API/RutrackerAPI.php";
include "ConfigReader.php";
include_once "classes/Utils.php";
$c = new ConfigReader();
$config = $c->getConfig();
$rt = new RutrackerAPI();
$rt->parse_user_params();
// Items from tracker
$flist = $rt->getFutureList();
// Items from saved file
//$file = $rt->read_from_file();
$file = Utils::read_from_file();
$items_from_file = array();
$new_items_counter = 0;
?>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Rtracker lists</title>

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
Exemple #5
0
 /**
  * Search method
  * @param $search_string
  * @param array $options
  * * ! `pn` search post parameter must be in cp1251 encoding
  * @return array with founded items or array with error
  */
 public function search($search_string, $options = array())
 {
     $errors = array();
     $search_string = trim($search_string);
     //post type for first search, get type for subsequent
     $curl = curl_init();
     if (self::$is_search_first_run) {
         curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_FOLLOWLOCATION, 1, CURLOPT_USERAGENT, self::$user_agent, CURLOPT_URL => self::$main_page . "tracker.php", CURLOPT_POST => true, CURLOPT_HEADER => false, CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, CURLOPT_MAXREDIRS => 10, CURLOPT_ENCODING => 'gzip,deflate', CURLOPT_COOKIESESSION, 1));
     } else {
         $params = "?search_id=" . $options[0]['search_id'] . "&start=" . $options[0]['start'] . "&nm=" . $options[0]['nm'];
         curl_setopt_array($curl, array(CURLOPT_URL => self::$main_page . "tracker.php" . $params, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION, true, CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, CURLOPT_HEADER => false, CURLOPT_MAXREDIRS => 10, CURLOPT_ENCODING => 'gzip,deflate'));
     }
     curl_setopt($curl, CURLOPT_COOKIEJAR, realpath(self::$cookies));
     curl_setopt($curl, CURLOPT_COOKIEFILE, realpath(self::$cookies));
     //if exist any search options
     if (empty($options)) {
         curl_setopt($curl, CURLOPT_POSTFIELDS, array("nm" => $search_string));
     } elseif (self::$is_search_first_run) {
         curl_setopt($curl, CURLOPT_POSTFIELDS, $options);
     }
     if (!($resp = curl_exec($curl))) {
         trigger_error(curl_error($curl));
         return $errors['error'] = "<br> <h2 class='align-center'>Неправильный запрос</h2> <br>";
     }
     curl_close($curl);
     if (self::$is_search_first_run) {
         $search_result = $this->parse_search_result($resp, $search_string);
         if (isset($search_result['pages']) && isset($search_result['search_id'])) {
             self::$is_search_first_run = false;
             $id = $search_result['search_id'];
             $pages = $search_result['pages'];
             for ($i = 1; $i < $pages; $i++) {
                 $arr = $this->search($search_string, array(array("nm" => $search_string, "start" => $i * 50, "search_id" => $id)));
                 $search_result = array_merge($search_result, $arr);
             }
             self::$is_search_first_run = true;
             return $search_result;
         } else {
             return $search_result;
         }
     } else {
         return $this->parse_search_result($resp, $search_string);
     }
 }