本文整理汇总了PHP中Base::_cget方法的典型用法代码示例。如果您正苦于以下问题:PHP Base::_cget方法的具体用法?PHP Base::_cget怎么用?PHP Base::_cget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base::_cget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getVideoData
private static function getVideoData($vid)
{
//pptv 接口 http://play.api.pptv.com/boxplay.api?cb=json&auth=mpptv&ver=2&id=16904252&ft=5&type=mpptv&platform=ikan&_=1382552026550
$file_array = $data = array();
$get_url = "http://play.api.pptv.com/boxplay.api?cb=json&auth=mpptv&ver=2&id=" . $vid . "&ft=5&type=mpptv&platform=ikan&_=" . time() . mt_rand(100, 999);
$video_json = rtrim(ltrim(Base::_cget($get_url), 'json ('), ');');
$video_data = json_decode($video_json, true);
foreach ($video_data['childNodes'] as $nodeVals) {
//获得影片名称和视频文件参数
if ($nodeVals['tagName'] == 'channel') {
$data['title'] = $nodeVals['nm'];
$data['seconds'] = $nodeVals['dur'];
foreach ($nodeVals['childNodes'] as $nodeVal) {
if ($nodeVal['tagName'] == 'file') {
foreach ($nodeVal['childNodes'] as $node) {
if ($node['tagName'] == 'item') {
//获取视频文件参数地址
$file_array[$node['ft']]['file'] = $node['rid'];
$file_array[$node['ft']]['height'] = $node['height'];
$file_array[$node['ft']]['width'] = $node['width'];
}
}
}
}
}
//获得视频地址参数
if ($nodeVals['tagName'] == 'dt') {
foreach ($nodeVals['childNodes'] as $nodeVal) {
//获取视频ip地址
if ($nodeVal['tagName'] == 'sh') {
$file_array[$nodeVals['ft']]['host'] = $nodeVal['childNodes'][0];
}
//获取视频key值
if ($nodeVal['tagName'] == 'key') {
$file_array[$nodeVals['ft']]['key'] = $nodeVal['childNodes'][0];
}
}
}
}
if (!empty($file_array)) {
foreach ($file_array as $key => $val) {
//构建视频地址 视频地址不能带 key值
if ($key == 0) {
$data['normal'][] = 'http://' . $val['host'] . '/0/' . $val['file'] . '?k=' . $val['key'] . '&type=web.fpp';
}
if ($key == 1) {
$data['high'][] = 'http://' . $val['host'] . '/0/' . $val['file'] . '?k=' . $val['key'] . '&type=web.fpp';
}
if ($key == 2) {
$data['super'][] = 'http://' . $val['host'] . '/0/' . $val['file'] . '?k=' . $val['key'] . '&type=web.fpp';
}
if ($key == 5) {
$data['fluent'][] = 'http://' . $val['host'] . '/0/' . $val['file'] . '?k=' . $val['key'] . '&type=web.fpp';
}
}
return $data;
} else {
return false;
}
}
示例2: _getYouku
/**
* [_getYouku description]
* @param [type] $vid [视频id]
* @return [type] [description]
*/
public static function _getYouku($vid)
{
//$link = "http://v.youku.com/player/getPlayList/VideoIDS/{$vid}/Pf/4"; //获取视频信息json 有些视频获取不全(土豆网的 火影忍者)
$link = "http://v.youku.com/player/getPlayList/VideoIDS/{$vid}/timezone/+08/version/5/source/out/Sc/2?ev=1&ran=" . mt_rand(1999, 8999) . "&n=3&ctype=60&password=";
// ?号后面的参数可不要
$retval = Base::_cget($link);
if ($retval) {
$rs = json_decode($retval, true);
if (!empty($rs['data'][0]['error'])) {
return false;
//有错误返回false
}
$data = array();
$streamtypes = $rs['data'][0]['streamtypes'];
//可以输出的视频清晰度
$streamfileids = $rs['data'][0]['streamfileids'];
$seed = $rs['data'][0]['seed'];
$segs = $rs['data'][0]['segs'];
foreach ($segs as $key => $val) {
if (in_array($key, $streamtypes)) {
foreach ($val as $k => $v) {
$no = strtoupper(dechex($v['no']));
//转换为16进制 大写
if (strlen($no) == 1) {
$no = "0" . $no;
//no 为每段视频序号
}
$_k = !empty($v['k']) ? $v['k'] : $rs['data'][0]['key2'] . $rs['data'][0]['key1'];
//构建视频地址K值
$fileId = self::getFileid($streamfileids[$key], $seed);
//判断后缀类型 、获得后缀
$typeArray = array("flv" => "flv", "mp4" => "mp4", "hd2" => "flv", "3gphd" => "mp4", "3gp" => "flv", "hd3" => "flv");
//判断视频清晰度
$sharpness = array("flv" => "normal", "flvhd" => "normal", "mp4" => "high", "hd2" => "super", "3gphd" => "high", "3gp" => "normal", "hd3" => "original");
//清晰度 数组
$fileType = $typeArray[$key];
$startId = substr($fileId, 0, 8);
//截取 拼凑 fileid
$endId = substr($fileId, 10, strlen($fileId));
$data[$sharpness[$key]][$k] = "http://f.youku.com/player/getFlvPath/sid/" . self::getSid() . "_{$no}/st/{$fileType}/fileid/" . $startId . $no . $endId . "?K=" . $_k;
}
}
}
//返回 图片 标题 链接 时长 视频地址
$data['img'] = $rs['data'][0]['logo'];
$data['title'] = $rs['data'][0]['title'];
$data['seconds'] = $rs['data'][0]['seconds'];
return $data;
} else {
return false;
}
}
示例3: parseXml
/**
* [parseXml 解析相关xml]
* @param [type] $url [description]
* @return [type] [description]
*/
public static function parseXml($url)
{
$xml_str = Base::_cget($url);
$xml_obj = @simplexml_load_string($xml_str);
$playurl = $xml_obj->playurl;
if (!empty($playurl)) {
$play_str = strval($playurl);
$play_json = json_decode($play_str, true);
if (is_array($play_json)) {
return $play_json;
} else {
return false;
}
} else {
return false;
}
}
示例4: parseXml
private static function parseXml($url)
{
$video = $seconds = $title = '';
$video_url = array();
$xml_str = Base::_cget($url);
if (!empty($xml_str)) {
$video = @simplexml_load_string($xml_str);
$seconds = intval($video->timelength) / 1000;
//获得时长
$title = strval($video->vname);
//解析视频地址
$durl = $video->durl;
for ($i = 0; $i < $durl->count(); $i++) {
$video_url[] = strval($durl[$i]->url);
}
return array("title" => $title, "seconds" => $seconds, 'url' => $video_url);
} else {
return false;
}
}
示例5: parse
public static function parse($url)
{
$key = "";
$data = $keys = array();
//pps 的站点数组
$pps_sites = array("dp.ugc.pps.tv", "dp.ppstream.com", "dp.ppstv.com");
if (strpos($url, "/play_") != false) {
$keys = explode('.', substr($url, strpos($url, "play_") + 5));
$key = $keys[0] ? trim($keys[0]) : '';
if ($key) {
foreach ($pps_sites as $val) {
//pps 的api 接口 http://dp.ppstv.com/get_play_url_cdn.php?sid=312WAZ&flash_type=1&type=0 type = 0/1/2 貌似表示清晰度?
$get_url = "http://" . $val . "/get_play_url_cdn.php?sid=" . $key . "&flash_type=1";
//$headers = @get_headers($get_url); 根据返回的状态来判断 is_array($headers) && (strrpos($headers[0], "200") != false)
$video_str = @Base::_cget($get_url);
if (!empty($video_str) && strpos($video_str, ".pfv") != false) {
$video_array = explode("&", $video_str);
$data['normal'][] = substr($video_str, 0, strpos($video_str, "?"));
$data['title'] = $video_array[2] ? ltrim($video_array[2], 'title=') : '';
$data['seconds'] = $video_array[5] ? ltrim($video_array[5], 'ct=') : '';
break;
}
}
if (!empty($data)) {
$html = Base::_cget($url);
$video_ids = array();
preg_match('#video_id:\\s*"([^"]+)"#', $html, $video_ids);
$video_id = $video_ids[1] ? trim($video_ids[1]) : '';
//pps 的html5 接口
$h5_url = "http://active.v.pps.tv/ugc/ajax/aj_html5_url.php?url_key={$key}&video_id={$video_id}";
$h5_data = json_decode(substr(ltrim(Base::_cget($h5_url), "html5url("), 0, -1), true);
$data['fulent'][] = $h5_data[0]['path'];
}
return $data;
} else {
return false;
}
} else {
return false;
}
}
示例6: parse
public static function parse($url)
{
$data = $vid_array = $video_data = array();
$vid = '';
if (strpos($url, "vid-")) {
$vid_array = explode(".", substr($url, strrpos($url, "vid-") + 4));
$vid = $vid_array[0];
} else {
if (strpos($url, "v_")) {
$vid_array = explode(".", substr($url, strrpos($url, "v_") + 2));
$vid = $vid_array[0];
}
}
if (!empty($vid)) {
//获取56视频的地址
$video_url = "http://vxml.56.com/json/{$vid}/?src=site";
$video_json = Base::_cget($video_url);
$video_data = json_decode($video_json, true);
if (is_array($video_data) && !empty($video_data['info']['rfiles'])) {
$data['title'] = $video_data['info']['Subject'];
$data['seconds'] = ceil(intval($video_data['info']['duration']) / 1000);
foreach ($video_data['info']['rfiles'] as $key => $val) {
if ($val['type'] == "normal") {
$data['normal'][] = $val['url'];
}
if ($val['type'] == "clear") {
$data['high'][] = $val['url'];
}
if ($val['type'] == "super") {
$data['super'][] = $val['url'];
}
}
return $data;
} else {
return false;
}
} else {
return false;
}
}
示例7: getVideoData
private static function getVideoData($pid)
{
$data = array();
//http://pgmsvr.tv189.cn/program/getVideoPlayInfo?pid={$pid} 此api已经过期
$getUrl = "http://pgmsvr.tv189.cn/program/getVideoPlayInfo2?pid={$pid}";
//获得视频地址的新api地址 2014年2月改版的
$videoXml = Base::_cget($getUrl);
if (empty($videoXml)) {
return false;
}
$strXml = @simplexml_load_string($videoXml);
$videoObj = $strXml->dt->ct;
$data['title'] = strval($videoObj->tt);
$urls = $videoObj->url;
if ($urls->count() > 0 && is_object($urls)) {
for ($i = 0; $i < $urls->count(); $i++) {
foreach ($urls[$i]->attributes() as $key => $val) {
//视频地址需要去掉最后的end=300 里的300 否者只能播放300秒 即5分钟
if ($key == 'cr' && $val == "450P") {
$data['normal'][] = rtrim(strval($urls[$i]), '300');
}
if ($key == 'cr' && $val == "720P") {
$data['high'][] = rtrim(strval($urls[$i]), '300');
}
if ($key == 'cr' && $val == "1080P") {
$data['super'][] = rtrim(strval($urls[$i]), '300');
}
if ($key == 'tm' && empty($data['seconds'])) {
$data['seconds'] = strval($val);
}
}
}
return $data;
} else {
return false;
}
}
示例8: parse
public static function parse($url)
{
$html = Base::_cget($url);
$videos = $infos = $data = $video_data = array();
preg_match("#VIDEOINFO\\s*=\\s*(\\{[\\s\\S]+?\\})#ms", $html, $videos);
//修复json 里面的 键值不能像 http:// 等 存在冒号的 否则会 修复失败
$infos = json_decode(preg_replace('@([\\w_0-9]+):@', '"\\1":', str_replace('\'', '"', $videos[1])), true);
if (empty($infos)) {
return false;
exit(0);
} else {
$limitrate = intval($infos['limit_rate'] * 1.2);
//通过拼接参数 来获得视频地址
$fhv_url = "http://pcvcr.cdn.imgo.tv/ncrs/vod.do?fid=" . $infos['code'] . "&limitrate=" . $limitrate . "&file=" . $infos['file'] . "&fmt=2&pno=1";
$m3u8_url = "http://pcvcr.cdn.imgo.tv/ncrs/vod.do?fid=" . $infos['code'] . "&limitrate=" . $limitrate . "&file=" . $infos['file'] . "&fmt=6&pno=3&m3u8=1";
$video_data = json_decode(Base::_cget($fhv_url), true);
if ($video_data) {
$data['normal'][] = $video_data['info'];
return $data;
} else {
return false;
}
}
}
示例9: getVideoRate
/**
* [getVideoRate 获得视频的码率数组]
* @param [type] $url [description]
* @return [type] [description]
*/
private static function getVideoRate($url)
{
$sharpness = array();
$video_info = json_decode(Base::_cget($url), true);
$video_rate = explode(";", $video_info["RateInfo"]);
if (is_array($video_rate) && !empty($video_rate)) {
foreach ($video_rate as $key => $val) {
$tmp_array = explode("@", $val);
if ($tmp_array[1] == "流 畅") {
$sharpness["fluent"] = $tmp_array[0];
}
if ($tmp_array[1] == "标 清") {
$sharpness["normal"] = $tmp_array[0];
}
if ($tmp_array[1] == "高 清") {
$sharpness["high"] = $tmp_array[0];
}
if ($tmp_array[1] == "超 清") {
$sharpness["super"] = $tmp_array[0];
}
}
}
return $sharpness;
}
示例10: getKey
/**
* [getKey 根据参数获得视频地址参数]
* @param [type] $vid [description]
* @param [type] $filename [description]
* @param [type] $vt [description]
* @param [type] $format [description]
* @return [type] [description]
*/
private static function getKey($vid, $filename, $vt, $format)
{
$url = "http://vv.video.qq.com/getkey";
$data = array("otype" => "json", "charge" => "0", "ran" => floatval('0.' . mt_rand(10000000, 90000000)), "filename" => $filename, "platform" => "11", "format" => $format, "vid" => $vid, "vt" => $vt, "defaultfmt" => "hd");
$jsonStr = Base::_cget($url, Base::USER_AGENT, $data, self::REFERER);
$jsonArr = json_decode(substr($jsonStr, strpos($jsonStr, '{'), -1), true);
return $jsonArr;
}
示例11: parseFlv2
/**
* [parseFlv2 解析网站flv格式的视频,第二种方法]
* @param [type] $tvid [description]
* @param [type] $vid [description]
* @return [type] [description]
*/
private static function parseFlv2($tvid, $vid)
{
$api_url = "http://cache.video.qiyi.com/vms?key=fvip&src=1702633101b340d8917a69cf8a4b8c7c";
$api_url = $api_url . "&tvId=" . $tvid . "&vid=" . $vid . "&vinfo=1&tm=" . self::$deadpara . "&enc=" . static::calenc($tvid);
$video_datas = json_decode(Base::_cget($api_url), true);
$vs = $video_datas['data']['vp']['tkl'][0]['vs'];
//.data.vp.tkl[0].vs
$time_url = "http://data.video.qiyi.com/t?tn=" . static::randomFloat();
$time_datas = json_decode(Base::_cget($time_url), true);
$server_time = $time_datas['t'];
$urls_data = $data = array();
if (is_array($vs) && count($vs) > 0) {
foreach ($vs as $val) {
//720p 和1080p 的视频地址暂时无法获得。
$data['seconds'] = $val['duration'];
foreach ($val['fs'] as $v) {
$this_link = $v['l'];
if ($val['bid'] == 4 || $val['bid'] == 5 || $val['bid'] == 10) {
$this_link = static::getVrsEncodeCode($this_link);
}
$sp = explode('/', $this_link);
$sp_length = count($sp);
$fileId = explode('.', $sp[$sp_length - 1])[0];
$this_key = static::calmd($server_time, $fileId);
$this_link = $this_link . '?ran=' . self::$deadpara . '&qyid=08ca8cb480c0384cb5d3db068161f44f&qypid=' . $tvid . '_11&retry=1';
$final_url = "http://data.video.qiyi.com/" . $this_key . "/videos" . $this_link;
if ($val['bid'] == 96) {
$urls_data['fluent'][] = $final_url;
}
if ($val['bid'] == 1) {
$urls_data['normal'][] = $final_url;
}
if ($val['bid'] == 2) {
$urls_data['high'][] = $final_url;
}
if ($val['bid'] == 3) {
$urls_data['super'][] = $final_url;
}
if ($val['bid'] == 4) {
$urls_data['SUPER_HIGH'][] = $final_url;
}
if ($val['bid'] == 5) {
$urls_data['FULL_HD'][] = $final_url;
}
if ($val['bid'] == 10) {
$urls_data['FOUR_K'][] = $final_url;
}
}
}
if (!empty($urls_data['fluent'])) {
$data['极速'] = self::getVideoUrl($urls_data['fluent']);
}
if (!empty($urls_data['normal'])) {
$data['流畅'] = self::getVideoUrl($urls_data['normal']);
}
if (!empty($urls_data['high'])) {
$data['高清'] = self::getVideoUrl($urls_data['high']);
}
if (!empty($urls_data['super'])) {
$data['超清'] = self::getVideoUrl($urls_data['super']);
}
if (!empty($urls_data['SUPER_HIGH'])) {
$data['720P'] = self::getVideoUrl($urls_data['SUPER_HIGH']);
}
if (!empty($urls_data['FULL_HD'])) {
$data['1080P'] = self::getVideoUrl($urls_data['FULL_HD']);
}
if (!empty($urls_data['FOUR_K'])) {
$data['4K'] = self::getVideoUrl($urls_data['FOUR_K']);
}
return $data;
} else {
return false;
}
}
示例12: parseVideoUrl2
private static function parseVideoUrl2($vid, $sub_ip)
{
$data = $urls = $data_urls = array();
$api_url = "http://" . $sub_ip[0] . "/vrs_flash.action?vid={$vid}&out=0&g=8&r=2&t=0." . mt_rand(100, 999);
$video_data = json_decode(Base::_cget($api_url), true);
if (is_array($video_data) && !empty($video_data)) {
foreach ($video_data['data']['clipsURL'] as $key => $val) {
$su_key = $video_data['data']['su'][$key];
$url = "http://data.vod.itc.cn/preview?file=" . $su_key;
$urls[] = $url;
/*curl 获取header
$headers = Base::getHeader($url);
preg_match("#Location:\s*(.+)#",$headers,$locations);
$param_array = $locations[1];
*/
/* //一次获得一个视频地址的,速度慢
$param_array = get_headers($url,1);
//视频截图地址 http://data.vod.itc.cn/preview?file=/233/52/28FAAL9Tq9UX9kOatm6bj7.mp4&start=28
//相对视频地址 中间多了个thumb http://219.238.10.45/sohu/thumb/1/233/52/28FAAL9Tq9UX9kOatm6bj7.mp4?start=28&key=uGacwCdCKICxxJnliepKI_od5tZlsh3ONPL_ow..&n=13&a=4019&cip=101.39.251.131
$video_url = str_replace('/thumb/', '/',$param_array['Location']); //获得地址转向
$data[] = $video_url;
*/
}
$data_urls = self::rolling_curl_url2($urls);
ksort($data_urls);
//获得数组根据key值排序
$data = array_values($data_urls);
return $data;
} else {
return false;
}
}
示例13: getVideoList
public static function getVideoList($movie_id, $subids, $video_names)
{
$data = array();
if (is_array($subids) && count($subids) > 0) {
foreach ($subids as $k => $v) {
$data[$k]['name'] = iconv("gbk", "utf-8", $video_names[$k]);
//获得视频的名字
$url = "http://api.movie.kankan.com/vodjs/subdata/" . floor($movie_id / 1000) . "/" . $movie_id . "/" . $v . ".js";
$movie_str = Base::_cget($url);
preg_match("#surls:\\s*\\[([^]]+)\\]#", $movie_str, $surls);
eval('$surls_array = array(' . $surls[1] . ');');
//转化为数组
$surls_array = array_filter($surls_array);
// 过滤数组
preg_match("#msurls:\\s*\\[([^]]+)\\]#", $movie_str, $msurls);
eval('$msurls_array = array(' . $msurls[1] . ');');
$msurls_array = array_filter($msurls_array);
if (is_array($surls_array) && count($surls_array) > 0) {
foreach ($surls_array as $key => $val) {
$tmp_array = explode('/', $val);
$gcid = $tmp_array[4];
$data[$k]['flv'][self::$sharpness_array[$key]][] = self::getVideoUrl($gcid);
}
}
if (is_array($msurls_array) && count($msurls_array) > 0) {
foreach ($msurls_array as $key => $val) {
$tmp_array = explode('/', $val);
$gcid = $tmp_array[4];
$data[$k]['mp4'][self::$sharpness_array[$key]][] = self::getVideoUrl($gcid, "mp4");
}
}
}
}
return $data;
}
示例14: getFlvcdUrl
/**
* [getFlvcdUrl 通过flvcd来解析视频地址]
* @param [type] $url [description]
* @return [type] [description]
*/
public static function getFlvcdUrl($url)
{
$url = "http://www.flvcd.com/parse.php?kw=" . urlencode($url);
$result = array();
for ($i = 0; $i < 4; $i++) {
if ($i == 0) {
$url = $url . '&flag=one&format=super';
}
if ($i == 1) {
$url = $url . '&flag=one&format=high';
}
if ($i == 2) {
$url = $url . '&flag=one&format=normal';
}
if ($i == 3) {
$url = $url . '&flag=one&format=fluent';
}
$_str = Base::_cget($url);
$match = $matchs = array();
preg_match('/name="inf"\\s*value="([^"]+)"/i', $_str, $matchs);
//匹配多视频地址
$download = iconv('utf-8', 'gbk', '下载地址:');
preg_match('/' . $download . '([^<]*)<a href="([^"]+)"/i', $_str, $match);
preg_match('/title = "([^"]+)"/i', $_str, $names);
//匹配视频标题 $name 数组的第二个是标题
if ($match && trim($match[2])) {
$urls = trim($match[2]);
} else {
if (is_array($matchs) && !empty($matchs[1])) {
$urls = substr($matchs[1], -1) == '|' ? substr($matchs[1], 0, -1) : $matchs[1];
} else {
break;
}
}
if ($urls) {
switch ($i) {
case 0:
$sharpness = 'super';
break;
case 1:
$sharpness = 'high';
break;
case 2:
$sharpness = 'normal';
break;
case 3:
$sharpness = 'fluent';
break;
}
if ($sharpness == 'normal') {
$result['title'] = iconv('gbk', 'utf-8', $names[1]);
}
$result[$sharpness] = array_filter(explode('|', $urls));
}
}
return $result;
}
示例15: getPlayUrl
/**
* [getPlayUrl 根据前面拿到的url 获得视频地址]
* @param [type] $url [description]
* @return [type] [description]
*/
private static function getPlayUrl($url)
{
$tn = mt_rand(10000, 99999) * 865;
$url = $url . "&termid=1&format=1&hwtype=un&ostype=Windows8.1&tag=letv&sign=letv&expect=3&tn=0." . $tn . "&pay=0&rateid=1000";
$playJson = Base::_cget($url);
$urls = json_decode($playJson, true);
if ($urls['location']) {
return $urls['location'];
} else {
return false;
}
}