示例#1
0
 public static function GetRegZavodProgHoriz($zavod_prs, $solsko_leto = '')
 {
     include_once dirname(__FILE__) . '/../CurlTool.php';
     if ($solsko_leto == '') {
         if (date('m') >= 9 && date('m') <= 12) {
             $solsko_leto = date('Y') . '/' . (date('Y') + 1);
         } else {
             $solsko_leto = date('Y') - 1 . '/' . date('Y');
         }
     }
     $debug = true;
     $headers = array('Content-Type: text/xml; charset=utf-8', 'SOAPAction: \'https://paka1.mss.edus.si:443/WebServices/RegZavod/RegZavodServicePort\'');
     $curl = new curlTool(false, false, array(), $headers);
     $xml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:si="http://si.edu.mss.si/">' . "\n";
     $xml .= "\t" . '<soapenv:Header/>' . "\n";
     $xml .= "\t" . '<soapenv:Body>' . "\n";
     $xml .= "\t\t" . '<si:getRegZavodProgHoriz>' . "\n";
     $xml .= "\t\t\t" . '<SOLSKO_LETO_NAZIV>' . $solsko_leto . '</SOLSKO_LETO_NAZIV>' . "\n";
     $xml .= "\t\t\t" . '<ZAVOD_PRS>' . $zavod_prs . '</ZAVOD_PRS>' . "\n";
     $xml .= "\t\t" . '</si:getRegZavodProgHoriz>' . "\n";
     $xml .= "\t" . '</soapenv:Body>' . "\n";
     $xml .= '</soapenv:Envelope>';
     // echo 'XML request:', "\n", $xml, "\n\n";
     $result = $curl->fetchContent('https://paka1.mss.edus.si:443/WebServices/RegZavod/RegZavodServicePort', false, $xml);
     // print_r($result . "\n\n");
     $explode = explode('<ns2:getRegZavodProgHorizResponse xmlns:ns2="http://si.edu.mss.si/">', $result);
     $explode = explode('</ns2:getRegZavodProgHorizResponse>', $explode[1]);
     $result = '<document>' . $explode[0] . '</document>';
     libxml_use_internal_errors(true);
     $doc = simplexml_load_string($result);
     $doc = json_decode(json_encode($doc), true);
     $result = $doc['return'];
     $curl->cleanup();
     return $result;
 }
dbconn();
$res = get_torrent_downloaded();
echo "1111111</br>";
if (mysql_affected_rows()) {
    while ($item = mysql_fetch_array($res)) {
        // $fnam=iconv("gb2312//IGNORE","UTF-8",$item['filename']);
        $targetpath = $rss_torrent_path . "/test.torrent";
        echo "" . $targetpath . "</br>";
        $id = $item['id'];
        $dl_url = $item['dl_url'];
        echo "connecting to " . $dl_url . "\n";
        if ($item['length'] > $size_filter + 0) {
            echo "torrent: " . $item['name'] . "size too big,skip download \n";
            continue;
        }
        $fn = curlTool::downloadFile($dl_url, $targetpath);
        echo "goggo";
        checktorrent($fn);
        $torrent = new Torrent($fn);
        $hash = $torrent->hash_info();
        echo "torrent: " . $fn . " hash_info:  " . $hash . "\n";
        echo "updating torrent:" . $fn . ",id :" . $id . "\n";
        $basename = basename($fn);
        $dest_file = $watch_path . $basename;
        if (!copy($fn, $dest_file)) {
            echo "copy torrent: " . $fn . "to dest: " . $watch_path . " fails \n";
        }
        update_torrent_downloaded($id, $fn, $hash);
    }
}
mysql_free_result($res);
示例#3
0
function uploadTorrent_eku($torrent)
{
    $ipurl = 'http://222.199.184.40/nexusphp';
    /*********info neede for login ***********************/
    $username = '******';
    $password = '******';
    $loginurl = $ipurl . '/takelogin.php';
    /*********info needed for upload**********************/
    $uploadurl = $ipurl . '/takeupload_api.php';
    $referurl = $ipurl . '/upload.php';
    /*********dir for saving torrent when uploaded suceessfully******************/
    $dest_host = $ipurl . "/download.php?id=";
    $dest_passkey = "&passkey=292f839cc1c4dcd3da580eb23963e105";
    $dl_torrent_dir = '/data/transmission/transmission_watch/';
    /*************upload torrent *****************************/
    $fields['file'] = '@' . $torrent['filename'];
    $fields['name'] = $torrent['name'];
    $fields['small_descr'] = $torrent['small_descr'];
    $fields['url'] = $torrent['imdb'];
    $fields['nfo'] = '';
    $fields['descr'] = $torrent['descr'];
    $fields['type'] = '401';
    $fields['medium_sel'] = '';
    $fields['codec_sel'] = '';
    $fields['standard_sel'] = '';
    $fields['audiocodec_sel'] = '';
    $fields['team_sel'] = '';
    $fields['doubanid'] = $torrent['doubanid'];
    $fields['passkey'] = '292f839cc1c4dcd3da580eb23963e105';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $uploadurl);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_REFERER, $referurl);
    //curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_jar);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    //get redirect content
    curl_setopt($ch, CURLOPT_NOBODY, false);
    //curl_exec( $ch );
    $rs = curl_exec($ch);
    if ($error = curl_error($ch)) {
        die($error);
    }
    $str = sprintf("%s", $rs);
    $strid = $str;
    curl_close($ch);
    //print_r(htmlspecialchars($rs));
    echo "\n";
    //redownload  torrent
    echo "begin redownload torrent" . "\n";
    echo $str . "\n";
    //$pattern='/userdetails\.php\?id=[0-9]+/';
    $pattern = '/download\\.php\\?id=[0-9]+/';
    $count = preg_match_all($pattern, $str, $id, PREG_SET_ORDER);
    if ($count + 0 <= 0) {
        echo "no download url" . "\n";
    }
    foreach ($id as $item) {
        echo $item[0] . "\n";
        $middle = $item[0];
        echo "middle=" . $middle . "\n";
    }
    $host = $dest_host;
    $tail = $dest_passkey;
    $torrent_dir = $dl_torrent_dir;
    $newid = substr($strid, 32);
    include_once 'curl.download.php';
    $torrent_url = $host . $newid . $tail;
    $fn = curlTool::downloadFile($torrent_url, $torrent_dir);
    echo "Grab file path =", $fn, "\n";
    //var_dump(CurlTool::$attach_info);
    print_r(CurlTool::$attach_info);
    return $fn;
}
示例#4
0
<?php

include_once 'curl.download.php';
echo "Hello </br>";
//$fn=curlTool::downloadFile('http://pt.xsyu.edu.cn/download.php?id=783&passkey=xxxxxxx','./');
$fn = curlTool::downloadFile('http://bt.6xvod.com/download.php?id=122089&passkey=292f839cc1c4dcd3da580eb23963e105', 'PTtorrents/test.torrent');
echo "</br>Grab file path =", $fn, "\n";
var_dump(CurlTool::$attach_info);
print_r(CurlTool::$attach_info);