全球主机交流论坛

标题: 短信监控2欧毒妇是否有货脚本 (ˇˍˇ) [PHP]版 (ˇˍˇ) [打印本页]

作者: zhuzhenyu    时间: 2014-8-26 00:03
标题: 短信监控2欧毒妇是否有货脚本 (ˇˍˇ) [PHP]版 (ˇˍˇ)
本帖最后由 zhuzhenyu 于 2014-8-26 01:22 编辑

这个是我测试19欧的短信接收图:
(, 下载次数: 0)

废话不多说直接上脚本;
短信提醒是免费的。飞信API提供短信发送。
  1. <?php
  2.         header("Content-type: text/html; charset=utf-8");
  3.         date_default_timezone_set('PRC');
  4.         //这里填写自己的飞信账号和密码
  5.         define('FEIXIN_USER','138000138000');         //飞信账号
  6.         define('FEIXIN_PASS','123456');                        //飞信密码
  7.         //飞信内容接收者账号,如果发送多个用逗号隔开 138000138000,138001138001
  8.         define('FEIXIN_TOUSER','138000138001');
  9.         //以下内容切勿修改。
  10.         if (php_sapi_name() != 'cli')
  11.         {       
  12.                 die('该脚本必须运行在cli模式下');
  13.         }       
  14.         $url = "http://www.online.net/en/dedicated-server/dedibox-kidechire";
  15.         $feixin = "http://blog.zhuzhenyu.net/feixin/feixin.php?phone=".FEIXIN_USER."&passwd=".FEIXIN_PASS."&tophone=" . FEIXIN_TOUSER;
  16.         //获取
  17.         $opts = array(
  18.                         'http'=>array(
  19.                                         'method'=>'GET',
  20.                                         "User-Agent"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36",
  21.                                         "timeout"=>20
  22.                                 )
  23.                 );
  24.         $context = stream_context_create($opts);
  25.         $data = file_get_contents($url,false,$context);
  26.         if($data)
  27.         {
  28.                 $pattern = '/<span class="green-text">(.*)<\/span>/';
  29.                 preg_match_all($pattern, $data,$matches);
  30.                 if(!empty($matches[1]) && is_numeric($matches[1][0]))
  31.                 {
  32.                         //发送短信
  33.                         $send = $feixin . "&content=有" . $matches[1][0] . '个2欧毒妇出现啦';
  34.                         file_get_contents($send,false,$context);
  35.                 }
  36.         }
复制代码

执行

  1. #把上面脚本保存在文件里面。(路径和文件名可自定义)
  2. #起名字cron_online.php
  3. #放到如下路径:
  4. /root/cron_online.php
  5. #设置crontab定时检测.每隔五分钟。哈哈
  6. crontab -e
  7. #输入如下:保存
  8. #每隔五分钟。
  9. */5 * * * * /usr/local/bin/php  /root/cron_online.php  
  10. #下面这个是每隔30秒
  11. * * * * * * sleep 30 /usr/local/bin/php  /root/cron_online.php  
复制代码

不用谢,我是雷锋
(, 下载次数: 51)
作者: zhuzhenyu    时间: 2014-8-26 00:05
代码怎么贴上来就了乱了。。。。
作者: danwant    时间: 2014-8-26 00:06
收藏了。感谢大神

作者: _jerryjee    时间: 2014-8-26 00:10
多谢分享,不过对这2欧没什么兴趣
作者: h0stl0c    时间: 2014-8-26 00:11
本帖最后由 h0stl0c 于 2014-8-26 00:14 编辑

代码写不错。

赠送一个有货时订购页面的HTML吧。监控这个页面比较靠谱。


  1. <!DOCTYPE html>
  2. <html>
  3.   <head>
  4.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <title>Order - Server special offers - Online / Dedibox - Console</title>

  7.         <link rel="stylesheet" href="/css/621b889.css?9deb02de" />
  8.    
  9. <link rel="shortcut icon" href="/bundles/onlineconsole/images/favicon.ico?9deb02de" />
  10. <link rel="apple-touch-icon" sizes="57x57" href="/bundles/onlineconsole/images/apple-touch-icon-57x57.png?9deb02de" />
  11. <link rel="apple-touch-icon" sizes="114x114" href="/bundles/onlineconsole/images/apple-touch-icon-114x114.png?9deb02de" />
  12. <link rel="apple-touch-icon" sizes="72x72" href="/bundles/onlineconsole/images/apple-touch-icon-72x72.png?9deb02de" />
  13. <link rel="apple-touch-icon" sizes="60x60" href="/bundles/onlineconsole/images/apple-touch-icon-60x60.png?9deb02de" />
  14. <link rel="apple-touch-icon" sizes="120x120" href="/bundles/onlineconsole/images/apple-touch-icon-120x120.png?9deb02de" />
  15. <link rel="apple-touch-icon" sizes="76x76" href="/bundles/onlineconsole/images/apple-touch-icon-76x76.png?9deb02de" />
  16. <link rel="apple-touch-icon" href="/bundles/onlineconsole/images/apple-touch-icon-152x152.png?9deb02de" />
  17. <link rel="icon" type="image/png" href="/bundles/onlineconsole/images/favicon-96x96.png?9deb02de" sizes="96x96" />
  18. <link rel="icon" type="image/png" href="/bundles/onlineconsole/images/favicon-16x16.png?9deb02de" sizes="16x16" />
  19. <link rel="icon" type="image/png" href="/bundles/onlineconsole/images/favicon-32x32.png?9deb02de" sizes="32x32" />
  20. <meta name="msapplication-TileColor" content="#da532c">
  21. <meta name="msapplication-square70x70logo" content="/bundles/onlineconsole/images/mstile-70x70.png?9deb02de">
  22. <meta name="msapplication-square150x150logo" content="/bundles/onlineconsole/images/mstile-150x150.png?9deb02de">
  23. <meta name="msapplication-wide310x150logo" content="/bundles/onlineconsole/images/mstile-310x150.png?9deb02de">


  24.         <script src="/bundles/onlineconsole/js/jquery.min.js?9deb02de"></script>
  25.     <!--[if IE]>
  26.     <script type="text/javascript" src="/bundles/onlineconsole/js/online-ie-fixes.js?9deb02de"></script>
  27.   <![endif]-->
  28.     <script type="text/javascript" src="/bundles/onlineconsole/js/bootstrap.min.js?9deb02de"></script>
  29.     <script type="text/javascript" src="/bundles/onlineconsole/js/bootstrap-dropdown.js?9deb02de"></script>
  30.     <script type="text/javascript" src="/bundles/onlineconsole/js/bootstrap-tooltip.js?9deb02de"></script>
  31.         <script src="/bundles/onlineconsole/js/online-global.js?9deb02de"></script>
  32.    

  33. <script type="text/javascript">
  34. $(document).ready(function() {
  35.     $('.prevent-double-click').click(function(){
  36.         $('.loader').removeClass('hidden');
  37.         $('.prevent-double-click').addClass('hidden');
  38.     });
  39. });
  40. </script>

  41. <script type="text/javascript" src="/bundles/onlineconsole/js/online-order-server.js?9deb02de"></script>
  42. <script type="text/javascript" src="/bundles/onlineconsole/js/online-modal.js?9deb02de"></script>
  43. <script type="text/javascript" src="/bundles/onlineconsole/js/bootstrap-modal.js?9deb02de"></script>
  44. <script type="text/javascript">
  45.     OnlineOrderServer.baseUrl = '/en/order/server_limited';
  46. </script>

  47.   </head>

  48.     <body class="online">

  49.     <div class="container front">

  50. <div class="loader hidden"><span class="glyphicon glyphicon-refresh spin"></span> Please wait…</div>
  51. <div class="pull-left header small_ypadding no_xpadding small_ymargin">
  52.   <a href="/" class="no-underline logo-online">
  53.     <i class="iconline iconline-logonline"></i><span>Online.net</span><small>Hosting - Dedicated servers</small>
  54.   </a>
  55. </div>
  56. <div class="pull-right span3 bgcolor-phone text-center spaced">
  57.     <p class="glyphicon glyphicon-earphone pull-left hugeico small_padding  small_margin"></p>
  58.     <p class="bold h4 small_margin text-center small_padding" style="white-space:wrap">Sales support</p>
  59.     <p class="bold h4 small_margin text-center small_padding">+33 1 84 13 00 00</p>
  60.     <div class="clear"></div>
  61. </div>
  62. <div class="clear"></div>

  63. <div class="row-fluid">


  64. <div class="breadcrumbloc">
  65. <ul class="breadcrumb">
  66.   <li><a href="/en/order/server" >1. Server choice</a></li>
  67.     <li><span>2. Server options</span></li>
  68.   
  69.               <li><span>3. User Informations</span></li>
  70.       
  71.     <li><span>4. Summary</span></li>
  72.   
  73.         <li><span>5. Payment</span></li>
  74.   </ul></div>


  75.             </div>

  76.   <div class="clear"></div>
  77.   <div class="content">

  78.     <div class="main_content">

  79.    
  80.         
  81.         
  82.   <h1><span class="highlight">1. Server offers</span></h1>

  83. <div class="formulaire">


  84.     <p>Select a server model.</p>
  85.     <table class="server-availability col-striped">
  86.     <colgroup>
  87.         <col class="coloffer" />
  88.         <col class="colcpu" />
  89.         <col class="colram" />
  90.         <col class="colhdd" />
  91.         <col class="colconnect" />
  92.         <col class="colavailability" />
  93.         <col class="colprice" />
  94.         <col class="colaction" />
  95.     </colgroup>
  96.     <thead>
  97.     <tr>
  98.         <th>Offer</th>
  99.         <th>CPU</th>
  100.         <th>Memory</th>
  101.         <th class="colhdd">Disk(s)</th>
  102.         <th>Connectivity</th>
  103.         <th>Availability</th>
  104.         <th>Price / month</th>
  105.         <th>Action</th>
  106.     </tr>
  107.     </thead>
  108.     <tbody>
  109.         <tr >
  110.         <td>Dedibox kidéchire</td>
  111.         <td>Nano U2250 1,60GHz</td>
  112.         <td>2 GB</td>
  113.         <td>160 GB</td>
  114.         <td>1Gbit/sec</td>
  115.         <td>
  116.                                   <span class="label label-success">42</span>
  117.                       </td>
  118.         <td>1.99 € HT</td>
  119.         <td>
  120.                         <form method="post" action="/en/order/server_limited" id="server_934">
  121.                 <div>
  122.                     <input type="hidden" value="934" name="server">
  123.                     <input type="submit" value="Order" class="btn-small btn-primary btn ">
  124.                 </div>
  125.             </form>
  126.                     </td>
  127.     </tr>
  128.         </tbody>
  129.     </table>
  130. </div>

  131. <div id="modal-confirm" class="modal hide">
  132.     <h2 class="modal-header">This server model is currently on back order</h2>
  133.         <div class="modal-body">
  134.         You may order it right now but it won't be shipped until new units are available.    </div>
  135.     <div class="modal-footer">
  136.         <button class="btn" id="modal-cancel">Cancel</button>
  137.         <button class="btn btn-primary" id="modal-confirm-button">Order</button>
  138.     </div>
  139.     </div>

  140.    
  141.     </div>

  142.       <div class="footer clearfix text-right">
  143.     <p class="info"><a >Condition of Sales</a> - <a >T&S dedicated server</a> - <a >T&S dedirack</a> - <a >Legal notices</a><br />Copyright © 1999-2013 - Online SAS - BP 438 - 75366 Paris CEDEX 08 - RCS Paris B 433 115 904</p>
  144.         </div>

  145.   </div>
  146.         <script type="text/javascript">
  147.       $('.dropdown-toggle').dropdown();
  148.     </script>
  149.       </div>
  150.   </body>
  151. </html>
复制代码

作者: _jerryjee    时间: 2014-8-26 00:29
h0stl0c 发表于 2014-8-26 00:11
代码写不错。

赠送一个有货时订购页面的HTML吧。监控这个页面比较靠谱。

亲,你是用什么监控的?
作者: _jerryjee    时间: 2014-8-26 00:32
$pattern = '/<span class="label label-success">(.*)<\/span>/';
匹配这个就行了,呵呵。
作者: zhuzhenyu    时间: 2014-8-26 00:36
哈哈。提醒只是个幌子..直接模拟登录购买不是更好?这个只是写着玩。
作者: walkman660    时间: 2014-8-26 00:44
这种东西喜欢用SHELL,小巧方便
作者: _jerryjee    时间: 2014-8-26 00:46
walkman660 发表于 2014-8-26 00:44
这种东西喜欢用SHELL,小巧方便

分享一下脚本吧,亲
作者: walkman660    时间: 2014-8-26 00:49
crontab间隔30s的有问题
以秒间隔最稳妥的方法:
* * * * * bash
* * * * * sleep 30;bash
作者: walkman660    时间: 2014-8-26 01:03
_jerryjee 发表于 2014-8-26 00:46
分享一下脚本吧,亲

懒得找了,思路很简单
先系统配置SMTP发邮件
curl 网址,几次grep定位找到关键字,然后判断关键字有没有,有就用SMTP发邮件到手机号码邮箱,邮箱设置特定发件人短信提醒
脚本加到crontab里就OK了
作者: zhuzhenyu    时间: 2014-8-26 01:18
walkman660 发表于 2014-8-26 01:03
懒得找了,思路很简单
先系统配置SMTP发邮件
curl 网址,几次grep定位找到关键字,然后判断关键字有没有 ...

昨天已经写过了。。。。
作者: xunxingzhe    时间: 2014-8-26 06:33
提示: 作者被禁止或删除 内容自动屏蔽
作者: _jerryjee    时间: 2014-8-26 08:17
walkman660 发表于 2014-8-26 01:03
懒得找了,思路很简单
先系统配置SMTP发邮件
curl 网址,几次grep定位找到关键字,然后判断关键字有没有 ...

php 懂一点,shell语法不太懂。呵呵




欢迎光临 全球主机交流论坛 (https://loc.888543.xyz/) Powered by Discuz! X3.4