tools.php 556 B

12345678910111213141516171819202122
  1. <?php
  2. function get_root_domain($url)
  3. {
  4. $split_url = explode("/", $url);
  5. $base_url = $split_url[2];
  6. $base_url_main_split = explode(".", strrev($base_url));
  7. $root_domain = strrev($base_url_main_split[1]) . "." . strrev($base_url_main_split[0]);
  8. return $root_domain;
  9. }
  10. function request($url)
  11. {
  12. $ch = curl_init($url);
  13. curl_setopt($ch, CURLOPT_HEADER, false);
  14. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  15. $response = curl_exec($ch);
  16. return $response;
  17. }
  18. ?>