找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 833|回复: 9

[网络视频应用推荐 使用 疑问] 恩山大师傅,帮我写个简单的代理php

[复制链接]
比如下面地址作例子
http://49.7.253.139/live.local06.ctlcdn.com/00000110240390_1/playlist.m3u8
我想从49.7.253.1-255,让他自己找可用IP,能不能实现
我的恩山、我的无线 The best wifi forum is right here.
来自手机 | 显示全部楼层
既然简单为什么不自己写?不会?那就是不简单

点评

谢谢改正,麻烦大师指点了。  详情 回复 发表于 2023-12-28 22:59
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
0x90 发表于 2023-12-28 22:53
既然简单为什么不自己写?不会?那就是不简单

谢谢改正,麻烦大师指点了。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

  1. <?php

  2. $url = 'http://49.7.253.139/live.local06.ctlcdn.com/00000110240390_1/playlist.m3u8';
  3. $start_ip = '49.7.253.1';
  4. $end_ip = '49.7.253.255';

  5. for ($i = ip2long($start_ip); $i <= ip2long($end_ip); $i++) {
  6.     $current_ip = long2ip($i);
  7.     $ch = curl_init();
  8.     curl_setopt($ch, CURLOPT_URL, $url);
  9.     curl_setopt($ch, CURLOPT_PROXY, $current_ip);
  10.     curl_setopt($ch, CURLOPT_PROXYPORT, 80);
  11.     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
  12.     curl_setopt($ch, CURLOPT_TIMEOUT, 5);
  13.     curl_setopt($ch, CURLOPT_HEADER, 1);
  14.     curl_setopt($ch, CURLOPT_NOBODY, 1);
  15.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  16.     $output = curl_exec($ch);
  17.    
  18.     if (!curl_errno($ch)) {
  19.         $info = curl_getinfo($ch);
  20.         if ($info['http_code'] == 200) {
  21.             echo "可用IP地址: " . $current_ip . "\n";
  22.         }
  23.     }
  24.    
  25.     curl_close($ch);
  26. }

  27. ?>
复制代码


点评

如果是变第三第和四位数的IP怎么改呢? 是这样吗 ? $start_ip = '49.7.1.1'; $end_ip = '49.7.255.255';  详情 回复 发表于 2023-12-29 11:46
在for内更改url,你在更改代理ip?  发表于 2023-12-29 09:13
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

有空发帖不如问叫AI都能给你写出来了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

这种弄法你切换频道的时候会很慢吧。换个频道可能都要个几十秒……

点评

用不了,php运行速度很快,而且只变第四位ip,换台也就两三秒钟的样子  详情 回复 发表于 2023-12-29 11:43
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

EScZkc_1d8 发表于 2023-12-29 00:50
这种弄法你切换频道的时候会很慢吧。换个频道可能都要个几十秒……

用不了,php运行速度很快,而且只变第四位ip,换台也就两三秒钟的样子
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报


如果是变第三第和四位数的IP怎么改呢?
是这样吗 ?
$start_ip = '49.7.1.1';
$end_ip = '49.7.255.255';
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-29 08:11

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

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