全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 5286|回复: 30

[不限流量] 7欧1T =》撸了一个脚本给那些还想赶个online末班车的兄弟们...

[复制链接]
发表于 2017-7-2 22:16:23 | 显示全部楼层 |阅读模式
本帖最后由 Eric.c 于 2017-7-3 12:11 编辑

看到还是有人老是关注7o 1t 版本,没事按下f5....  所以给大家撸了一个代码玩玩。。。
已在4台服务器上测试过了。 能帮到也就酱紫了。。。


github: https://github.com/jekyllcao/online.net


确保是linux服务器,已经安装了php

将下面的代码给保存成一个php文件(如文件名a.php),然后设置crontab 的任务。


crontab -e 回车
按 i ,然后输入  */1 * * * *  php的执行路径      a.php的绝对路径
按esc ,再输入:wq 退出。


ps: 如果你php安装的是lnmp套件(lnmp.org),那么php的执行路径是 : /usr/bin/php,
如果你不确定,直接输入which php, 会有返回值







  1. <?php


  2. //=========================================Config info====================================================
  3. $offerid = "728";                 // 728:  7欧1t ,   774: 7欧ssd
  4. $title = "Online 有货了!";  //微信通知标题
  5. $desp = "Online 有货了!";         //微信通知内容
  6. $key = 'SCU6641T52d189fd61c651c03ba188a41a2280a558c8155xxx';  //方糖的微信通知的key,自己登录“http://sc.ftqq.com”申请




  7. //=========================================main selection====================================================
  8. $cmd ="curl 'https://console.online.net/en/order/server_limited' -H 'Pragma: no-cache' -H 'Origin: https://www.online.net' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4,zh-TW;q=0.2,ja;q=0.2,fr;q=0.2' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: no-cache' -H 'Referer: https://www.online.net/en/summer-2017/sales' -H 'Cookie: PHPSESSID-1=s602745rfibh2929tf6jh5o251; SERVERID=web-dc2; _pk_ref.2.3d3d=%5B%22%22%2C%22%22%2C1498936258%2C%22https%3A%2F%2Fwww.online.net%2Fen%2Fsummer-2017%2Fsales%22%5D; _pk_id.2.3d3d=20af576204479f2c.1491289136.47.1498936272.1498936258.; _gat_onlineTracker=1; _ga=GA1.2.1668319752.1490860501; _gid=GA1.2.1443765524.1498924054' -H 'Connection: keep-alive' --data 'server_offer=$offerid' --compressed";


  9. $data = shell_exec($cmd);
  10. if ( strpos($data,"unavailable")) {
  11.         echo "sold out";
  12.         // sc_send ("没货",$desp,$key);
  13. }
  14. else
  15. {
  16.         sc_send ($title,$desp,$key);
  17. }





  18. //=========================================function ====================================================

  19. function sc_send($text, $desp = '', $key ="") {
  20.         $postdata = http_build_query(
  21.     array('text' => $text, 'desp' => $desp));
  22.         $opts = array('http' =>
  23.                 array(
  24.                         'method'  => 'POST',
  25.                         'header'  => 'Content-type: application/x-www-form-urlencoded',
  26.                         'content' => $postdata
  27.                 )
  28.         );
  29.         $context = stream_context_create($opts);
  30.         return $result = file_get_contents('http://sc.ftqq.com/'.$key.'.send', false, $context);
  31. }
复制代码




====FAQ:=====

1/  不要直接在服务器上用vim修改,因为vim对中文的支持。。。。 所以还是在你本地上存文件后再上传吧
2/  上传后,手动执行一遍 php a.php , 看看是否有报错。
3/   如果报错,一般是php.ini中的disable_function函数禁止了,编辑这个文件,直接注释掉这行后重启 lnmp 或者php-fpm 即可
4/ 代码无技术支持。。。 别找我。。。 也别让我写自动登录和提交(看懂代码的自己扩展,so easy,需要花时间而已)。。。。








新增一个脚本,没做完整的可行性测试,仅在上面的代码上增加邮件通知,有需要的自己搞,要测试过的,不要看这部分。。。。。直接用上面的。。。====================

  1. <?php
  2. //=========================================HOW TO USE IT ====================================================
  3. /*
  4.         1/ save the code into a file  with "ANY.php" as  name
  5.         2/ config the setting as bellow,  
  6.         3/ pls run one time to check the health of the script . the problem is easy to fix . just do it by youself.
  7.         4/ create a cron rule like " * * * * *  /path/to/php /path/to/your/script "




  8. */





  9. //=========================================Config info====================================================
  10. $offerid = "645";                 // 728:  7欧1t ,   774: 7欧ssd

  11. $title = "Online can be order now !";   //Notify subject
  12. $desp = "Online content ......!";                 //Notify Content

  13. //Which notify method you want to use , 1: wechat; 0:Email
  14. $type = 1;   

  15.         // For mail notify method , We use local mail as sent method , So pls make sure the sendmail has been installed on your server.
  16.         $to ="chenfengye@gmail.com";                        //Mail Receiver

  17.         // For Wechat Notify method ,
  18.         $key = 'SCU6641T52d189fd61c651c03ba188a41a2280a558c8155d8c56e';  //方糖的微信通知的key,自己登录“http://sc.ftqq.com”申请




  19. //=========================================main selection====================================================
  20. $cmd ="curl 'https://console.online.net/en/order/server_limited' -H 'Pragma: no-cache' -H 'Origin: https://www.online.net' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4,zh-TW;q=0.2,ja;q=0.2,fr;q=0.2' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: no-cache' -H 'Referer: https://www.online.net/en/summer-2017/sales' -H 'Cookie: PHPSESSID-1=s602745rfibh2929tf6jh5o251; SERVERID=web-dc2; _pk_ref.2.3d3d=%5B%22%22%2C%22%22%2C1498936258%2C%22https%3A%2F%2Fwww.online.net%2Fen%2Fsummer-2017%2Fsales%22%5D; _pk_id.2.3d3d=20af576204479f2c.1491289136.47.1498936272.1498936258.; _gat_onlineTracker=1; _ga=GA1.2.1668319752.1490860501; _gid=GA1.2.1443765524.1498924054' -H 'Connection: keep-alive' --data 'server_offer=$offerid' --compressed";


  21. $data = shell_exec($cmd);
  22. if ( strpos($data,"unavailable")) {
  23.         echo "sold out";
  24.         // sc_send ("没货",$desp,$key);
  25. }
  26. else
  27. {
  28.         if($type)
  29.         {
  30.                 sc_send ($title,$desp,$key);       
  31.         }
  32.         else
  33.         {
  34.                 send($title,$desp,$to);
  35.         }
  36.        
  37. }





  38. //=========================================function ====================================================

  39. function sc_send($text, $desp = '', $key ="") {
  40.         $postdata = http_build_query(
  41.     array('text' => $text, 'desp' => $desp));
  42.         $opts = array('http' =>
  43.                 array(
  44.                         'method'  => 'POST',
  45.                         'header'  => 'Content-type: application/x-www-form-urlencoded',
  46.                         'content' => $postdata
  47.                 )
  48.         );
  49.         $context = stream_context_create($opts);
  50.         return $result = file_get_contents('http://sc.ftqq.com/'.$key.'.send', false, $context);
  51. }



  52. function sendmail($title,$desp,$to)
  53. {
  54.         $cmd = "echo "$desp" | mail -s "$title" $to";
  55.         $data = shell_exec($cmd);
  56.         if ( strpos($data,"not sent")) {
  57.                 echo "Fail to send ".$data;
  58.         }
  59.         else
  60.         {
  61.                 echo "Mail Sent";
  62.         }


  63. }
复制代码


 楼主| 发表于 2017-7-2 22:52:00 | 显示全部楼层
====FAQ:=====

1/  不要直接在服务器上用vim修改,因为vim对中文的支持。。。。 所以还是在你本地上存文件后再上传吧
2/  上传后,手动执行一遍 php a.php , 看看是否有报错。
3/   如果报错,一般是php.ini中的disable_function函数禁止了,编辑这个文件,直接注释掉这行后重启 lnmp 或者php-fpm 即可
发表于 2017-7-2 22:17:45 | 显示全部楼层
大佬厉害了。。
发表于 2017-7-2 22:18:31 | 显示全部楼层
厉害了word哥
发表于 2017-7-2 22:20:32 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2017-7-2 22:32:28 来自手机 | 显示全部楼层
太厉害了,收藏了                 
发表于 2017-7-2 22:44:58 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2017-7-2 22:45:40 | 显示全部楼层
已撸 看能不能撸个1T继续挂MT。。
发表于 2017-7-2 22:49:57 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2017-7-2 22:51:49 来自手机 | 显示全部楼层
厉害了我的哥
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-4-25 03:55 , Processed in 0.106772 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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