app抓包,根據介面開發web端

來源:互聯網
上載者:User

標籤:web   php   app   抓包   

平時喜歡看某個做視頻的app,最近app有bug,看著看著就會閃退,回到首頁,反饋給官方,好久也不處理,於是自己抓包app的介面,直接用php開發個web版本的自己用.
首先抓包過程就不說了,我的另一篇部落格有詳細介紹:
Charles抓包https,http
先看一下web的介面:


其實就兩個頁面,非常簡單,下面貼一下代碼,連結都去掉了,以免被壞人利用:

<?phpini_set(‘date.timezone‘,‘Asia/Shanghai‘);header("Content-Type:text/html;Charset=utf8");if(isset($_GET[‘type‘])){    $type = $_GET[‘type‘];}//判斷類型if(empty($type)){    $url_sort = ‘day‘;    $type=1;}else{    if($type==1){        $url_sort = $_GET[‘sort‘];    }else{        $catid = $_GET[‘cat‘];    }}//json轉數組方法function toarray($url){    $url = $url;    $json_str = file_get_contents($url);    $list = json_decode($json_str,true);    return $list;}    //擷取所有分類    $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;//排行視頻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‘){        //每日精選        $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("000","",$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{        //周,月,總排行        $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("000","",$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){    //分類    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("000","",$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("寫錯了您嘞!!!");}include("index_extend.html");?>

html檔案代碼:

<!DOCTYPE html><html><head>    <title>web版本</title>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />    <meta name="renderer" content="webkit">    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">    <link rel="stylesheet" href="./layui/css/layui.css"  media="all">    <!-- 讓IE8/9支援媒體查詢,從而相容柵格 -->    <!--[if lt IE 9]>      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>    <![endif]-->       <style type="text/css">        #div1{             position:fixed;             top:0;             left:0;             bottom:0;             right:0;             z-index:-1;             }         #div1 > img {             height:100%;             width:100%;             border:0;         }         .one:hover{            box-shadow: 5px 5px 5px #a6a6a6;        }        .layui-breadcrumb a {            color: #fff!important;            font-size: 18px        }        .page:hover{            font-size:15px;        }    </style></head><body ><div id="div1"><img src="bg.jpg" /></div> <div class="layui-row" style="width:80%;margin:30px auto" >     <span class="layui-breadcrumb" lay-separator="|" style="margin-left: 30px">        <a href="#">視頻排行:</a>  <a href="./index.php?type=1&sort=day">日排行</a>  <a href="./index.php?type=1&sort=week">周排行</a>  <a href="./index.php?type=1&sort=month">月排行</a>  <a href="./index.php?type=1&sort=zong">總排行</a></span><br/><br/>  <span class="layui-breadcrumb" lay-separator="|" style="margin-left: 30px">    <a href="#">分類:</a>    <?php foreach($cates as $kcat => $vcat){ ?>    <a href="./index.php?type=2&cat=<?php echo $vcat[‘id‘]; ?>"><?php echo $vcat[‘title‘]; ?></a>    <?php } ?></span></div><div class="layui-row" style="width:80%;margin:30px auto">    <?php foreach($res as $k => $v){ ?>    <div onclick="location=‘./detail.php?id=<?php echo $v[‘id‘] ?>‘" class="layui-col-xs12 layui-col-sm6 layui-col-md3" style="display: flex;">        <div class="one" style="background-color: white;width:100%;min-height: 100px;margin:10px;border-radius: 10px">            <div style="width:90%;height: 150px;margin:10px auto">                <img  width="100%" height="100%" style="border-radius: 10px" src="<?php echo $v[‘img‘]; ?>">            </div>            <div style="width:90%;min-height: 50px;margin:5px auto"><?php echo $v[‘title‘]; ?>            <br/><?php echo $v[‘time‘]; ?>            <br/><?php echo $v[‘tag‘]; ?>          </div>        </div>    </div>    <?php } ?></div><div class="layui-row" style="width:80%;margin:30px auto;" >    <?php         if(isset($_GET[‘page‘])){?><a href="./index.php?type=2&cat=<?php echo $_GET[‘cat‘]; ?>&page=<?php echo $_GET[‘page‘]-1; ?>" class="page" style="width:100px;padding:10px;background-color: white;border-radius: 10px;float: left;text-align: center;">上一頁</a>        <?php }else{        $_GET[‘page‘]=1;    }        ?>    <?php if($type==2){?>    <a href="./index.php?type=2&cat=<?php echo $_GET[‘cat‘]; ?>&page=<?php echo $_GET[‘page‘]+1; ?>" class="page" style="width:100px;padding:10px;background-color: white;border-radius: 10px;float: right;text-align: center;">下一頁</a>    <?php }?></div><script src="./layui/layui.js" charset="utf-8"></script><script>layui.use(‘element‘, function(){  var element = layui.element; //導航的hover效果、二級菜單等功能,需要依賴element模組});</script></body></html>

詳情頁的php代碼:

<?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代碼:

<!DOCTYPE html><html><head>    <title><?php echo $list[‘title‘]; ?></title>  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />    <meta name="renderer" content="webkit">    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">    <link rel="stylesheet" href="./layui/css/layui.css"  media="all">    <script type="text/javascript" src="//cytroncdn.videojj.com/latest/cytron.core.js"></script>    <!-- 讓IE8/9支援媒體查詢,從而相容柵格 -->    <!--[if lt IE 9]>      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>    <![endif]-->       <style type="text/css">        #div1{             position:fixed;             top:0;             left:0;             bottom:0;             right:0;             z-index:-1;             }         #div1 > img {             height:100%;             width:100%;             border:0;         }     </style></head><body ><div id="div1"><img src="bg.jpg" /></div> <div class="layui-row" style="width:80%;margin:30px auto">    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12" style="display: flex;">        <div class="one" style="background-color: white;width:100%;min-height: 100px;margin:10px;border-radius: 10px">            <div style="width:90%;min-height: 50px;margin:10px auto"><h2><?php echo $list[‘title‘]; ?></h2><br/>            <h3><?php echo $list[‘description‘]; ?></h3></div>          <div id="parent" style="width:90%;height: 600px;margin:20px auto">            </div>        </div>    </div></div><script src="./layui/layui.js" charset="utf-8"></script><script type="text/javascript">        var ivaInstance = new Iva(            ‘parent‘,//父容器id            {                appkey: #####‘,//必填,請在控制台查看應用標識                video: "<?php echo $list[‘playUrl‘]; ?>",//必填,播放地址(例如:http://v.youku.com/v_show/id_XMTY5NDg2MzY5Ng==.html)                title: "<?php echo $list[‘title‘]; ?>",//選填,建議填寫方便後台資料統計                cover: "<?php echo $list[‘coverForFeed‘]; ?>",//選填,視頻封面url                playerUrl: ‘‘, //選填,第三方播放器與Video++互動層的橋接檔案,由Video++官方定製提供,預設為空白                videoStartPrefixSeconds: 0,//選填,跳過標題,預設為0                videoEndPrefixSeconds: 0,//選填,跳過片尾,預設為0                /* 以下參數可以在“控制台->項目看板->應用管理->播放器設定” >進行全域設定,前端設定可以覆蓋全域設定 */                skinSelect: 0,//選填,播放器皮膚,可選0、1、2,預設為0,                autoplay: true,//選填,是否自動播放,預設為false                rightHand: false,//選填,是否開啟右鍵菜單,預設為false                autoFormat: true,//選填,是否自動選擇最高清晰度,預設為false                bubble: false,//選填,是否開啟雲泡功能,預設為true                jumpStep: 10,//選填,左右方向鍵快退快進的時間                tagTrack: false,//選填,雲鏈是否跟蹤,預設為false                tagShow: false,//選填,雲鏈是否顯示,預設為false                tagDuration: 5,//選填,雲鏈顯示時間,預設為5秒                tagFontSize: 16,//選填,雲鏈文字大小,預設為16像素                editorEnable: false, // 選填,當使用者登入之後,是否允許載入編輯器,預設為true                vorEnable: false, // 選填,是否允許載入靈悟,預設為true                vorStartGuideEnable: false //選填, 是否啟用靈悟新人引導,預設為true            }        );    </script></body></html>

ok,到此結束

app抓包,根據介面開發web端

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.