吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 520|回复: 8
收起左侧

写个获取josn的php

[复制链接]
头像被屏蔽
咸鱼派 发表于 2019-10-16 11:44
提示: 作者被禁止或删除 内容自动屏蔽

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

badyun 发表于 2019-10-16 11:44
本帖最后由 badyun 于 2019-10-17 10:30 编辑

这个接口不允许跨域,而且播放器加防盗链了,最后还是用php搞了。。。。

[PHP] 纯文本查看 复制代码
<?php
    $url = 'http://m.maohaha.com/system/mlooc_play.php?id=36';
    $html = file_get_contents($url);
?>

<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            outline: none;
        }
        html,
        body {
            width: 100%;
            height: 100%;
        }
        body{
            padding: 20px;
        }
        #hls-video{
            width:100%;
            height:60vw;
        }
        #content{
            border: 1px solid lightgray;
            border-bottom: 0;
            border-right: 0;
            margin-top:20px;
            display: flex;
            flex-wrap: wrap;
        }
        #content>div{
            width: 50%;
            height: 40px;
            line-height: 40px;
            border-bottom: 1px solid lightgray;
            border-right: 1px solid lightgray;
            text-align: center;
            cursor: pointer;
        }
    </style>
    <title></title>
</head>

<body>
    <iframe id="hls-video" src="" frameborder="0"></iframe>
    <section id="content">

    </section>
    <script>

        window.onload = () => {
            let content = <?php echo $html ?>;
            document.title = content.title
            let cell = document.getElementById('content')
            content.result.forEach((ele,i) => {
                ele.url = ele.url.replace('/player/player.php?url=', 'http://jiexi.071811.cc/jx2.php?url=')
                let div = document.createElement('div')
                div.innerText = ele.collection
                div.onclick = ()=>{
                    let video = document.getElementById('hls-video')
                    video.setAttribute("src", ele.url)
                }
                cell.append(div)

                // 默认播放第一集
                if(i==0){
                    div.click()
                }
            });
        }



    </script>
</body>

</html>
badyun 发表于 2019-10-16 13:25
本帖最后由 badyun 于 2019-10-16 13:27 编辑

这个都不用php的,我写给你
misenlin 发表于 2019-10-16 14:00
头像被屏蔽
 楼主| 咸鱼派 发表于 2019-10-16 15:41
提示: 作者被禁止或删除 内容自动屏蔽
头像被屏蔽
 楼主| 咸鱼派 发表于 2019-10-17 22:35
提示: 作者被禁止或删除 内容自动屏蔽
头像被屏蔽
 楼主| 咸鱼派 发表于 2019-10-17 22:46
提示: 作者被禁止或删除 内容自动屏蔽
badyun 发表于 2019-10-17 23:57
咸鱼派 发表于 2019-10-17 22:46
追问一下大佬:
假如php文件存储为play.php,访问地址为http://abc.com/play.php?id=36 代码里这行 http ...

修改下前面就行了


[PHP] 纯文本查看 复制代码
<?php
    empty($_GET['id']) && $_GET['id'] = 36;
    $url = 'http://m.maohaha.com/system/mlooc_play.php?id='.$_GET['id'];
    $html = file_get_contents($url);
?>

<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            outline: none;
        }
        html,
        body {
            width: 100%;
            height: 100%;
        }
        body{
            padding: 20px;
        }
        #hls-video{
            width: 100%;
            height: 60vw;
        }
        #content{
            border: 1px solid lightgray;
            border-bottom: 0;
            border-right: 0;
            margin-top:20px;
            display: flex;
            flex-wrap: wrap;
        }
        #content>div{
            width: 50%;
            height: 40px;
            line-height: 40px;
            border-bottom: 1px solid lightgray;
            border-right: 1px solid lightgray;
            text-align: center;
            cursor: pointer;
        }
    </style>
    <title></title>
</head>

<body>
    <iframe id="hls-video" src="" frameborder="0"></iframe>
    <section id="content">

    </section>
    <script>

        window.onload = async () => {
            let content = <?php echo $html ?>;
            document.title = content.title
            let cell = document.getElementById('content')
            content.result.forEach((ele,i) => {
                ele.url = ele.url.replace('/player/player.php?url=', 'http://jiexi.071811.cc/jx2.php?url=')
                let div = document.createElement('div')
                div.innerText = ele.collection
                div.onclick = ()=>{
                    let video = document.getElementById('hls-video')
                    video.setAttribute("src", ele.url)
                }
                cell.append(div)

                // 默认播放第一集
                if(i==0){
                    div.click()
                }
            });
        }



    </script>
</body>

</html>
头像被屏蔽
 楼主| 咸鱼派 发表于 2019-10-18 00:06
提示: 作者被禁止或删除 内容自动屏蔽
快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-26 04:33

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表