App capture, web-based interface development

Source: Internet
Author: User
Tags php foreach

Usually like to watch a video of the app, the recent app has a bug, look at will flash back, return to the home page, feedback to the official, a long time also do not deal with, so he grabbed the package app interface, directly with PHP to develop a web version of their own use.
First grab the package process will not say, my other blog has detailed description:
Charles Grab Bag Https,http
First look at the Web interface:


In fact, two pages, very simple, paste the following code, links are removed, so as not to be used by the bad guys:

<?phpini_set (' Date.timezone ', ' Asia/shanghai '); header ("content-type:text/html; Charset=utf8 "), if (Isset ($_get[' type ')) {$type = $_get[' type '];}    Judgment type if (empty ($type)) {$url _sort = ' Day '; $type = 1;}    else{if ($type ==1) {$url _sort = $_get[' sort '];    }else{$catid = $_get[' cat '];    }}//json to Array method function ToArray ($url) {$url = $url;    $json _str = file_get_contents ($url);    $list = Json_decode ($json _str,true);    return $list;}    Get all categories $url = "#######";    $list = ToArray ($url);        for ($a =3; $a <count ($list [' itemList ']), $a + +) {$cates [$a] [' id '] = $list [' itemList '] [$a] [' data '] [' id '];    $cates [$a] [' title '] = Str_replace (' # ', ' ", $list [' itemList '] [$a] [' data '] [' title ']);    }//echo "<pre>";          Print_r ($cates); exit;//ranked video if ($type ==1) {switch ($url _sort) {case ' day ': $url = ' ####### ';          Break          Case ' Week ': $url = "#######";        Break  Case ' month ': $url = "#######";        Break            Case ' zong ': $url = "##### #l";    Break        } if ($url _sort== ' Day ') {//daily featured $list = ToArray ($url);                for ($i =1; $i <count ($list [' itemList ']), $i + +) {if (!empty ($list [' itemList '] [$i] [' Data '] [' content ']) {                $res _list[$i] [' id '] = $list [' itemList '] [$i] [' Data '] [' content '] [' data '] [' id '];                $res _list[$i [' title '] = $list [' itemList '] [$i] [' data '] [content '] [' data '] [' title '];                $res _list[$i [' img '] = $list [' itemList '] [$i] [' data '] [content '] [' data '] [' cover '] [' feed '];                $res _list[$i [' time '] = date ("y-m-d", Str_replace ("", "", $list [' itemList '] [$i] [' Data '] [' header '] [' time ']);                $res _list[$i [' tag '] = "";                $tags _arr = $list [' itemList '] [$i] [' Data '] [' content '] [' data '] [' tags ']; foreach ($tags _arr as $ktag = + $vtag) {$res _list[$i] [' tag ']. = $vtag [' name ']. "                 ";       }}}}else{ Week, month, total ranking $list = ToArray ($url);                for ($i =0; $i <count ($list [' itemList ']), $i + +) {$res _list[$i] [' id '] = $list [' itemList '] [$i] [' Data '] [' id '];                $res _list[$i [' title '] = $list [' itemList '] [$i] [' Data '] [' title '];                $res _list[$i] [' img '] = $list [' itemList '] [$i] [' Data '] [' cover '] [' feed '];                $res _list[$i [' time '] = date ("y-m-d", Str_replace ("The", "", $list [' itemList '] [$i] [' Data '] [' releasetime ']);                $res _list[$i [' tag '] = "";                $tags _arr = $list [' itemList '] [$i] [' Data '] [' tags ']; foreach ($tags _arr as $ktag = + $vtag) {$res _list[$i] [' tag ']. = $vtag [' name ']. "                 "; }}} $res = $res _list;}    ElseIf ($type ==2) {//category if (Empty ($_get[' page ')) {$page = 1;    }else{$page = $_get[' page ');    } $num = 20;    $start = ($page-1) * $NUM;    $url = "http://####?limit={$start}&num={$num}&id={$catid}";      $list = ToArray ($url);  for ($i =0; $i <count ($list [' itemList ']), $i + +) {$res _list[$i] [' id '] = $list [' itemList '] [$i] [' Data '] [' id '];                $res _list[$i [' title '] = $list [' itemList '] [$i] [' Data '] [' title '];                $res _list[$i] [' img '] = $list [' itemList '] [$i] [' Data '] [' cover '] [' feed '];                $res _list[$i [' time '] = date ("y-m-d", Str_replace ("The", "", $list [' itemList '] [$i] [' Data '] [' releasetime ']);                $res _list[$i [' tag '] = "";                $tags _arr = $list [' itemList '] [$i] [' Data '] [' tags ']; foreach ($tags _arr as $ktag = + $vtag) {$res _list[$i] [' tag ']. = $vtag [' name ']. "                 "; }} $res = $res _list;} Else{die ("you wrote the wrong!!!");} Include ("index_extend.html");? >

HTML file code:

<! DOCTYPE html>

PHP code for the details page:

<?phpini_set(‘date.timezone‘,‘Asia/Shanghai‘);header("Content-Type:text/html;Charset=utf8");if(isset($_GET[‘id‘])){ $id = $_GET[‘id‘];}//json转数组方法function toarray($url){ $url = $url; $json_str = file_get_contents($url); $list = json_decode($json_str,true); return $list;}$url = "http://######";$list = toarray($url);if(!empty($list[‘playInfo‘][1][‘urlList‘][0][‘url‘])){ $list[‘playUrl‘] = $list[‘playInfo‘][1][‘urlList‘][0][‘url‘];}// echo ‘<pre>‘;// print_r($list);exit;include("detail.html");?>

HTML code for the details page:

<! DOCTYPE html>

OK, it's over.

App capture, web-based interface development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.