Example #1
0
 public function xml_feifei($array_url)
 {
     //组合资源库URL地址并获取XML资源
     $array_tpl['httpurl'] = admin_ff_url_repalce($array_url['xmlurl']) . 'index.php?s=plus/api/xml/cms/ff/action/' . $array_url['action'] . '/vodids/' . $array_url['vodids'] . '/cid/' . $array_url['cid'] . '/play/' . $array_url['play'] . '/inputer/' . $array_url['inputer'] . '/wd/' . urlencode($array_url['wd']) . '/h/' . $array_url['h'] . '/p/' . $array_url['p'];
     $array_tpl['httpurl'] = str_replace('@', '-', $array_tpl['httpurl']);
     $xml = ff_file_get_contents($array_tpl['httpurl']);
     //抓取资源是否成功
     if ($xml) {
         //组合分页信息
         preg_match('<list page="([0-9]+)" pagecount="([0-9]+)" pagesize="([0-9]+)" recordcount="([0-9]+)">', $xml, $page_array);
         $xml_page['recordcount'] = $page_array[4];
         $xml_page['pagecount'] = $page_array[2];
         $xml_page['pagesize'] = $page_array[3];
         $xml_page['pageindex'] = $page_array[1];
         $array_url['p'] = '{!page!}';
         $array_tpl['pageurl'] = U('Admin-Xml/Feifei', $array_url);
         $array_tpl['pagelist'] = '共' . $xml_page['recordcount'] . '条数据&nbsp;页次:' . $xml_page['pageindex'] . '/' . $xml_page['pagecount'] . '页&nbsp;' . getpage($xml_page['pageindex'], $xml_page['pagecount'], 5, $array_tpl['pageurl'], 'pagego(\'' . $array_tpl['pageurl'] . '\',' . $xml_page['pagecount'] . ')');
         //组合绑定分类
         preg_match_all('/<ty id="([0-9]+)">([\\s\\S]*?)<\\/ty>/', $xml, $list_array);
         foreach ($list_array[1] as $key => $value) {
             $list[$key]['list_id'] = $value;
             $list[$key]['list_name'] = $list_array[2][$key];
             $list[$key]['bind_id'] = $array_url['fid'] . '_' . $list[$key]['list_id'];
         }
         //组合数据
         preg_match_all('/<video><last>([\\s\\S]*?)<\\/last><id>([0-9]+)<\\/id><tid>([0-9]+)<\\/tid><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><type>([\\s\\S]*?)<\\/type><dt>([\\s\\S]*?)<\\/dt><pic>([\\s\\S]*?)<\\/pic><lang>([\\s\\S]*?)<\\/lang><area>([\\s\\S]*?)<\\/area><year>([\\s\\S]*?)<\\/year><state>([\\s\\S]*?)<\\/state><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><actor><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/actor><director><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/director><dl>([\\s\\S]*?)<\\/dl><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des><reurl>([\\s\\S]*?)<\\/reurl><\\/video>/', $xml, $vod_array);
         //组合数据
         foreach ($vod_array[1] as $key => $value) {
             $vod[$key]['vod_addtime'] = $value;
             $vod[$key]['vod_id'] = $vod_array[2][$key];
             $vod[$key]['vod_cid'] = intval(getbindval($array_url['fid'] . '_' . $vod_array[3][$key]));
             $vod[$key]['vod_name'] = $vod_array[4][$key];
             $vod[$key]['list_name'] = $vod_array[5][$key];
             //以下参数只在内容页才有
             $vod[$key]['vod_pic'] = $vod_array[7][$key];
             $vod[$key]['vod_language'] = $vod_array[8][$key];
             $vod[$key]['vod_area'] = $vod_array[9][$key];
             $vod[$key]['vod_year'] = $vod_array[10][$key];
             $vod[$key]['vod_continu'] = $vod_array[11][$key];
             $vod[$key]['vod_title'] = $vod_array[12][$key];
             $vod[$key]['vod_actor'] = htmlspecialchars_decode($vod_array[13][$key]);
             $vod[$key]['vod_director'] = htmlspecialchars_decode($vod_array[14][$key]);
             $vod[$key]['vod_content'] = htmlspecialchars_decode($vod_array[16][$key]);
             $vod[$key]['vod_inputer'] = $array_url['fid'] . '_' . $vod[$key]['vod_id'];
             $vod[$key]['vod_reurl'] = str_replace('||', '//', $vod_array[17][$key]);
             if (!$vod[$key]['vod_reurl']) {
                 $vod[$key]['vod_reurl'] = $array_url['reurl'] . $vod[$key]['vod_id'];
                 //$vod[$key]['vod_reurl'] = 'http://'.get_domain($array_url['xmlurl']).'/'.$array_url['reurl'].$vod[$key]['vod_id'];
             }
             preg_match_all('/<dd flag="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/dd>/', $vod_array[15][$key], $url_arr);
             $vod[$key]['vod_play'] = implode('$$$', $url_arr[1]);
             $vod[$key]['vod_url'] = htmlspecialchars_decode(implode('$$$', $url_arr[2]));
         }
         //dump($vod);
         $array['url'] = $array_url;
         //远程URL变量
         $array['tpl'] = $array_tpl;
         //本地模板变量
         $array['page'] = $xml_page;
         //远程分页信息
         $array['listclass'] = $list;
         //远程分类变量
         $array['listvod'] = $vod;
         //远程数据变量
         return $array;
     }
     return false;
 }
Example #2
0
 /**
  * 将资源站抓取的值整理成数组变量(飞飞+光线)
  * 
  * @param  $array_url
  * @param  $xml
  */
 public function ff_gx_xml($array_url, $xml)
 {
     //组合分页信息
     preg_match('<list page="([0-9]+)" pagecount="([0-9]+)" pagesize="([0-9]+)" recordcount="([0-9]+)">', $xml, $page_array);
     $xml_page['recordcount'] = $page_array[4];
     $xml_page['pagecount'] = $page_array[2];
     $xml_page['pagesize'] = $page_array[3];
     $xml_page['pageindex'] = $page_array[1];
     $array_url['p'] = '{!page!}';
     $array_tpl['pageurl'] = U('Admin-Collect/Gxcms', $array_url);
     $array_tpl['pagelist'] = '共' . $xml_page['recordcount'] . '条数据&nbsp;页次:' . $xml_page['pageindex'] . '/' . $xml_page['pagecount'] . '页&nbsp;' . get_cms_page_css($xml_page['pageindex'], $xml_page['pagecount'], 5, $array_tpl['pageurl'], 'pagego(\'' . $array_tpl['pageurl'] . '\',' . $xml_page['pagecount'] . ')');
     //组合绑定分类
     preg_match_all('/<ty id="([0-9]+)">([\\s\\S]*?)<\\/ty>/', $xml, $array_list);
     foreach ($array_list[1] as $key => $value) {
         $list[$key]['cid'] = $value;
         $list[$key]['cname'] = $array_list[2][$key];
         $list[$key]['bind_id'] = $array_url['fid'] . '_' . $value;
     }
     //组合单个影视数据
     preg_match_all('/<video><last>([\\s\\S]*?)<\\/last><id>([0-9]+)<\\/id><tid>([0-9]+)<\\/tid><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><type>([\\s\\S]*?)<\\/type><dt>([\\s\\S]*?)<\\/dt><pic>([\\s\\S]*?)<\\/pic><lang>([\\s\\S]*?)<\\/lang><area>([\\s\\S]*?)<\\/area><year>([\\s\\S]*?)<\\/year><state>([\\s\\S]*?)<\\/state><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><actor><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/actor><director><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/director><dl>([\\s\\S]*?)<\\/dl><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des><reurl>([\\s\\S]*?)<\\/reurl><\\/video>/', $xml, $array_vod);
     foreach ($array_vod[1] as $key => $value) {
         $vod[$key]['addtime'] = $value;
         $vod[$key]['id'] = $array_vod[2][$key];
         $vod[$key]['iid'] = $array_vod[2][$key];
         $vod[$key]['cid'] = getbindval($array_url['fid'] . '_' . $array_vod[3][$key]);
         $vod[$key]['title'] = htmlspecialchars_decode($array_vod[4][$key]);
         $vod[$key]['cname'] = $array_vod[5][$key];
         $vod[$key]['picurl'] = $array_vod[7][$key];
         $vod[$key]['language'] = $array_vod[8][$key];
         $vod[$key]['area'] = $array_vod[9][$key];
         $vod[$key]['year'] = $array_vod[10][$key];
         $vod[$key]['serial'] = $array_vod[11][$key];
         $vod[$key]['intro'] = htmlspecialchars_decode($array_vod[12][$key]);
         $vod[$key]['actor'] = htmlspecialchars_decode($array_vod[13][$key]);
         $vod[$key]['director'] = htmlspecialchars_decode($array_vod[14][$key]);
         $vod[$key]['content'] = htmlspecialchars_decode($array_vod[16][$key]);
         $vod[$key]['inputer'] = $array_url['fid'] . '_' . $vod[$key]['id'];
         $vod[$key]['reurl'] = $array_vod[17][$key];
         if (!$vod[$key]['reurl']) {
             $vod[$key]['reurl'] = str_replace('@', '/', $array_url['reurl']) . $vod[$key]['id'];
         }
         preg_match_all('/<dd flag="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/dd>/', $array_vod[15][$key], $url_arr);
         $vod[$key]['playurl'] = htmlspecialchars_decode(implode('$$$', $url_arr[2]));
     }
     $array['url'] = $array_url;
     //远程URL变量
     $array['tpl'] = $array_tpl;
     //本地模板变量
     $array['page'] = $xml_page;
     //远程分页信息
     $array['listclass'] = $list;
     //远程分类变量
     $array['listvod'] = $vod;
     //远程数据变量
     return $array;
 }