Advertisement
Guest User

sending time

a guest
Jan 19th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. <?php
  2. echo "check sms sending time - type your phone number here";
  3. echo "<form action='' method='post'>
  4. <input type='to'>
  5. <input type='submit'>
  6. </form>";
  7. if (isset($_POST['to']))
  8. {
  9. $to = $_POST['to'];
  10.  
  11. $time_start = microtime(true);
  12. date_default_timezone_set("Asia/Dhaka");
  13.  
  14. $date = date("l jS \of F Y h:i:s A");
  15. $server = "http://api.greenweb.com.bd/api.php?token=yourtokenhere&message=ok&to=$to";
  16. function checkOnline($domain) {
  17. $curlInit = curl_init($domain);
  18. curl_setopt($curlInit, CURLOPT_ENCODING, '');
  19. curl_setopt($curlInit,CURLOPT_CONNECTTIMEOUT,10);
  20. curl_setopt($curlInit, CURLOPT_NOBODY, true);
  21. curl_setopt($curlInit, CURLOPT_HEADER, true);
  22. curl_setopt($curlInit,CURLOPT_RETURNTRANSFER,true);
  23. curl_setopt($curlInit, CURLOPT_VERBOSE,true);
  24. curl_setopt($curlInit, CURLOPT_FORBID_REUSE, 1);
  25. curl_setopt($curlInit, CURLOPT_HTTPHEADER, array('Connection: Close'));
  26. $response = curl_exec($curlInit);
  27. if(curl_errno($curlInit))
  28. {
  29. echo 'Curl error: ' . curl_error($curlInit);
  30.  
  31. }
  32.  
  33. curl_close($curlInit);
  34. if ($response) return true;
  35. return false;
  36. }
  37.  
  38.  
  39. echo checkOnline("$server");
  40.  
  41. $time_end = microtime(true);
  42.  
  43. //dividing with 60 will give the execution time in minutes otherwise seconds
  44. $execution_time = ($time_end - $time_start);
  45.  
  46. //execution time of the script
  47. echo "time $execution_time </br>";
  48. }
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement