【问题标题】:How to use Apis to view lines in Xtream code 2.9.2?Xtream代码2.9.2如何使用Apis查看行?
【发布时间】:2019-09-10 10:41:49
【问题描述】:

如何从 Xtream Code CMS 中查看行?

我正在使用一些 API,但无法查看行,它总是向我显示“拒绝访问”。 如何允许 API 访问?我有 Xtream 代码 2.9.2 版本。 我知道要使用 API,我们必须从 General Settings -> API Settings 将我们的 IP 地址导入白名单。这是 Xtream 代码 2.3.x 中的一个选项,但在以后的版本中,它们已经改变了一些东西。默认情况下,他们已禁用 API 访问。在我们拥有的当前版本的 Xtream 代码中没有这种类型的选项。 有什么解决办法吗? xtream code 2.9.2如何允许API访问?

<?php
$panel_url = 'https://cms.xtream-codes.com/xxxx/'; //i am giving my cms xtream code panel link here

$username = "xxxx";  //i am giving my xtream code cms username here
$password = "xxxx";  //i am giving my xtream code cms password here


##############################################################################
$post_data = array( 'username' => $username, 'password' => $password );
$opts = array( 'http' => array(
        'method' => 'POST',
        'header' => 'Content-type: application/x-www-form-urlencoded',
        'content' => http_build_query( $post_data ) ) );

$context = stream_context_create( $opts );
$api_result = json_decode( file_get_contents( $panel_url . "api.php?action=user&sub=info", false, $context ), true );
echo  implode( ',', $api_result);
?>

访问被拒绝

【问题讨论】:

    标签: api video-streaming live-streaming iptv


    【解决方案1】:

    很确定 $panel_url 指的是你的主服务器的 URL,而不是你的 cms 面板

    【讨论】:

    • 请提供完整答案
    【解决方案2】:

    我使用 xtream-codes V2 API 检查活动订阅信息的解决方案 为您的表单创建一个 Index.php 页面

    <form class="form-inline"  action="submit.php" method="post">
    
        <div class="form-group">
          <input type="text" class="form-control" id="username" placeholder="Enter Lines Username" name="username">
          <input type="text" class="form-control" id="password" placeholder="Enter Lines Password" name="password">
        <button type="submit" id="submit" class="btn btn-primary" name="submit">GET STREAM IDS</button>
    </form>
    

    创建submit.php 并将您的表单操作指向它

     <?php
    $surname = $_POST['surname'];
    $username = $_POST['username'];
    $password = $_POST['password'];
    $exp_date = date("d-m-Y",$json['user_info']["exp_date"]);
    
    
    
    $json = json_decode(file_get_contents("http://<-YOUR DNS ->:<-YOUR PORT ->/panel_api.php?username=$username&password=$password"), true);
    ?>
    
    <?php echo $json['user_info']["username"];?></a>
    <?php echo $json['user_info']["password"];?></a>
    <?php echo $json['user_info']["status"];?></a>
    <?php echo $exp_date;?></a>
    
    and create a line download button like this
      <a href="http://<-YOUR DNS ->:<-YOUR PORT ->/get.php?username=<?php print $json['user_info']["username"];?>&password=<?php print $json['user_info']["password"];?>&type=m3u_plus&output=ts" class="btn btn-primary">DOWNLOAD PLAYLIST</a>
    

    下面的代码将根据输入的线路订阅包生成一个活跃频道及其TS号的表格

    <table>
        <thead>
          <tr>
            <th width="50%"><center>STREAM NAME</center></th>
            <th width="50%"><center>STREAM TS NUMBER</center></th>
          </tr>
        </thead>
        <tbody>
          <tr>
    <?php
    $username = $_POST['username'];
    $password = $_POST['password'];
    $json = json_decode(file_get_contents("http://<-YOUR DNS ->:<-YOUR PORT ->/player_api.php?username=$username&password=$password&action=get_live_streams"), true);
    for ($x = 0; $x < count($json); $x++)
    { ?>
    
    
    <td><center><strong><?php echo $json[$x]['name'];?></strong></center></td>
    
    <td><center><strong><?php echo $json[$x]['stream_id'];?></strong></center></td>
    </tr>
    <?php } ?>
    

    这些可能不是最好的方法,但它们很管用,而且我自己也用过

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-08-04
      • 1970-01-01
      • 2016-07-07
      • 2023-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多