本文整理汇总了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;
}
示例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;
示例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;
}
示例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";
}