本文整理汇总了PHP中Snoopy::get_filename方法的典型用法代码示例。如果您正苦于以下问题:PHP Snoopy::get_filename方法的具体用法?PHP Snoopy::get_filename怎么用?PHP Snoopy::get_filename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Snoopy
的用法示例。
在下文中一共展示了Snoopy::get_filename方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Snoopy
$cli = new Snoopy();
$cli->agent = HTTP_USER_AGENT;
$cli->read_timeout = HTTP_TIME_OUT;
$cli->use_gzip = HTTP_USE_GZIP;
$pos = strpos($url, ':COOKIE:');
if ($pos !== false) {
$tmp = explode(";", substr($url, $pos + 8));
foreach ($tmp as $item) {
list($name, $val) = explode("=", $item);
$cli->cookies[$name] = $val;
}
$url = substr($url, 0, $pos);
}
set_time_limit(0);
if (@$cli->fetch($url) && $cli->status >= 200 && $cli->status < 300) {
$name = $cli->get_filename();
if ($name === false) {
$name = md5($url) . ".torrent";
}
$uploaded_file = getUploadsPath() . "/" . $name;
$f = @fopen($uploaded_file, "w");
if ($f !== false) {
@fwrite($f, $cli->results, strlen($cli->results));
fclose($f);
$success = true;
}
}
}
}
if ($success) {
@chmod($uploaded_file, 0666);