当前位置: 首页>>代码示例>>PHP>>正文


PHP Snoopy::fetchComplex方法代码示例

本文整理汇总了PHP中Snoopy::fetchComplex方法的典型用法代码示例。如果您正苦于以下问题:PHP Snoopy::fetchComplex方法的具体用法?PHP Snoopy::fetchComplex怎么用?PHP Snoopy::fetchComplex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Snoopy的用法示例。


在下文中一共展示了Snoopy::fetchComplex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: makeClient

 public static function makeClient($url, $method = "GET", $content_type = "", $body = "")
 {
     $client = new Snoopy();
     $client->read_timeout = 5;
     $client->_fp_timeout = 5;
     @$client->fetchComplex($url, $method, $content_type, $body);
     return $client;
 }
开发者ID:anthonyryan1,项目名称:ruTorrent,代码行数:8,代码来源:check.php

示例2: rawurldecode

    $tracker = rawurldecode($_REQUEST["tracker"]);
    $name = dirname(__FILE__) . "/trackers/" . $tracker . ".png";
    if (is_readable($name)) {
        sendFile($name, "image/png");
        exit;
    }
    $name = getSettingsPath() . '/trackers';
    if (!is_dir($name)) {
        makeDirectory($name);
    }
    $name .= '/';
    if (strlen($tracker)) {
        $name .= $tracker;
        $name .= '.ico';
        if (!is_readable($name)) {
            $url = Snoopy::linkencode("http://" . $tracker . "/favicon.ico");
            $client = new Snoopy();
            @$client->fetchComplex($url);
            if ($client->status == 200) {
                file_put_contents($name, $client->results);
            }
        }
        if (is_readable($name)) {
            sendFile($name, "image/x-icon");
            exit;
        }
    }
}
header("HTTP/1.0 302 Moved Temporarily");
header("Location: " . dirname($_SERVER['PHP_SELF']) . '/trackers/unknown.png');
exit;
开发者ID:anthonyryan1,项目名称:ruTorrent,代码行数:31,代码来源:action.php

示例3: fetchURL

 protected static function fetchURL($url, $cookies = null, $headers = null)
 {
     $client = new Snoopy();
     if (is_array($headers) && count($headers)) {
         $client->rawheaders = $headers;
     }
     if (is_array($cookies) && count($cookies)) {
         $client->cookies = $cookies;
     }
     @$client->fetchComplex($url);
     return $client;
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:12,代码来源:rss.php

示例4: getUniqueUploadedFilename

         if (pathinfo($ufile, PATHINFO_EXTENSION) != "torrent") {
             $ufile .= ".torrent";
         }
         $ufile = getUniqueUploadedFilename($ufile);
         $ok = move_uploaded_file($file['tmp_name'], $ufile);
         $uploaded_files[] = array('name' => $file['name'], 'file' => $ufile, 'status' => $ok ? "Success" : "Failed");
     }
 } else {
     if (isset($_REQUEST['url'])) {
         $url = trim($_REQUEST['url']);
         $uploaded_url = array('name' => $url, 'status' => "Failed");
         if (strpos($url, "magnet:") === 0) {
             $uploaded_url['status'] = rTorrent::sendMagnet($url, !isset($_REQUEST['torrents_start_stopped']), !isset($_REQUEST['not_add_path']), $dir_edit, $label) ? "Success" : "Failed";
         } else {
             $cli = new Snoopy();
             if (@$cli->fetchComplex($url) && $cli->status >= 200 && $cli->status < 300) {
                 $name = $cli->get_filename();
                 if ($name === false) {
                     $name = md5($url) . ".torrent";
                 }
                 $name = getUniqueUploadedFilename($name);
                 $f = @fopen($name, "w");
                 if ($f !== false) {
                     @fwrite($f, $cli->results, strlen($cli->results));
                     fclose($f);
                     $uploaded_url['file'] = $name;
                     $uploaded_url['status'] = "Success";
                 }
             } else {
                 $uploaded_url['status'] = "FailedURL";
             }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:31,代码来源:addtorrent.php


注:本文中的Snoopy::fetchComplex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。