0

如何从 Xtream Code CMS 中查看行?

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

拒绝访问

4

2 回答 2

0

我使用 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 } ?>

这些可能不是最好的方法,但它们有效,我实际上使用自己

于 2019-07-27T00:32:32.877 回答
0

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

于 2019-05-21T15:26:25.760 回答