本文整理汇总了PHP中curl::getSize方法的典型用法代码示例。如果您正苦于以下问题:PHP curl::getSize方法的具体用法?PHP curl::getSize怎么用?PHP curl::getSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类curl
的用法示例。
在下文中一共展示了curl::getSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getVideoDownLoadUrl
public function getVideoDownLoadUrl()
{
$content = file_get_contents($this->url);
preg_match('#movieDescription=\'([^\']+)\'#', $content, $result);
if (!($title = $result[1])) {
preg_match("#<title>(.+)</title>#", $content, $result);
$title = $result[1];
}
$title = iconv('gb2312//ignore', 'utf-8', $title);
$this->title = $title;
preg_match('#<source src="([^"]+)#', $content, $src) or preg_match('#<source type="[^"]+" src="([^"]+)"#', $content, $src);
$videoSrc = $src[1] ? $src[1] : '';
if ($videoSrc) {
preg_match('#(.+)-mobile.mp4#', $videoSrc, $sdUrls);
$sdUrl = $sdUrls[1] . '.flv';
$hdUrl = preg_replace('#SD#', 'HD', $sdUrl);
$curl = new curl();
$sdHeader = $curl->curlGet302($sdUrl);
$hdHeader = $curl->curlGet302($hdUrl);
$sdSize = $curl->getSize($sdHeader);
$hdSize = $curl->getSize($hdHeader);
if ($sdSize > $hdSize) {
$url = $sdUrl;
} else {
$url = $hdUrl;
}
$this->ext = 'flv';
} else {
preg_match('#["\'](.+)-list.m3u8["\']#', $content, $urls) || preg_match('#["\'](.+).m3u8["\']#', $content, $urls);
$url = $urls[1] . '.mp4';
$this->ext = 'mp4';
}
return $url;
}
示例2: urlencode
echo '<p align="center">下载列表:</p>
<ul>';
/* now that we have the array, print the options */
for ($i = 0; $i < count($avail_formats); $i++) {
echo '<li>';
echo '<span class="itag">' . $avail_formats[$i]['itag'] . '</span> ';
if ($config['VideoLinkMode'] == 'direct' || $config['VideoLinkMode'] == 'both') {
echo '<a href="' . $avail_formats[$i]['url'] . '&title=' . $cleanedtitle . '" class="mime">' . $avail_formats[$i]['type'] . '</a> ';
} else {
echo '<span class="mime">' . $avail_formats[$i]['type'] . '</span> ';
}
echo '<small>(' . $avail_formats[$i]['quality'];
if ($config['VideoLinkMode'] == 'proxy' || $config['VideoLinkMode'] == 'both') {
echo ' / ' . '<a href="download.php?mime=' . $avail_formats[$i]['type'] . '&title=' . urlencode($my_title) . '&token=' . base64_encode($avail_formats[$i]['url']) . '" class="dl">download</a>';
}
echo ')</small> ' . '<small><span class="size">' . $common->formatBytes($curl->getSize($avail_formats[$i]['url'])) . '</span></small>' . '</li>';
}
//echo '</ul><small>Note that you initiate download either by clicking video format link or click "download" to use this server as proxy.</small>';
echo '<ul><small>由于网络受限,下载的视频会存在本地硬盘,下载后还需要再手动上传到vms系统中</small></ul>';
if ($config['feature']['browserExtensions'] == true && is_chrome()) {
// echo '<a href="ytdl.user.js" class="userscript btn btn-mini" title="Install chrome extension to view a \'Download\' link to this application on Youtube video pages."> Install Chrome Extension </a>';
}
?>
</body>
</html>
<?php
} else {
/* In this else, the request didn't come from a form but from something else
* like an RSS feed.