Created
April 6, 2020 02:05
-
-
Save athlona64/06aeac1b7f7f9e4061dd4d2336854e93 to your computer and use it in GitHub Desktop.
check active node with line notify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $content = file_get_contents("https://lokiblocks.com/service_nodes"); | |
| $data= explode('</a></td>', $content); | |
| $a = 1; | |
| $active = ''; | |
| $count = 0; | |
| foreach($data as $value) | |
| { | |
| $sn = substr($value, -64); | |
| if($sn == 'print_sn_key') | |
| { | |
| $count++; | |
| $active .= "\nLoki_1 is active"; | |
| }else if($sn == 'print_sn_key'){ | |
| $count++; | |
| $active .= "\nLoki_2 is active"; | |
| }else if($sn == 'print_sn_key'){ | |
| $count++; | |
| $active .= "\nLoki_3 is active"; | |
| }else if($sn == 'print_sn_key'){ | |
| $count++; | |
| $active .= "\nLoki_4 is active"; | |
| } | |
| } | |
| $line_token = ['token','token']; | |
| for($i =0 ; $i<2;$i++) | |
| { | |
| $line_token[$i]; | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, "https://notify-api.line.me/api/notify"); | |
| curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); | |
| curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); | |
| curl_setopt($ch, CURLOPT_POST, 1); | |
| curl_setopt($ch, CURLOPT_POSTFIELDS, "message= ". $active." \n\nNode running: ".$count." node"); | |
| curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); | |
| curl_setopt($ch, CURLOPT_HTTPHEADER, [ | |
| 'Content-type: application/x-www-form-urlencoded', | |
| 'Authorization: Bearer '.$line_token[$i], | |
| ]); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| curl_exec($ch); | |
| curl_close($ch); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment