{"id":17976144,"url":"https://github.com/zidansec/php-parsing-domain","last_synced_at":"2025-05-06T19:41:04.831Z","repository":{"id":109491467,"uuid":"564478584","full_name":"zidansec/php-parsing-domain","owner":"zidansec","description":"Simple PHP code for parsing domains, automatically fetching the TLD of the domain or subdomain.","archived":false,"fork":false,"pushed_at":"2023-08-15T00:30:49.000Z","size":12,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T02:12:21.776Z","etag":null,"topics":["api-client","api-rest","domain-data","domain-extractor","domain-name","php","php-cheatsheet","php-functions"],"latest_commit_sha":null,"homepage":"https://zidansec.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zidansec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-10T20:06:00.000Z","updated_at":"2024-09-06T00:15:47.000Z","dependencies_parsed_at":"2024-10-29T17:33:59.032Z","dependency_job_id":null,"html_url":"https://github.com/zidansec/php-parsing-domain","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zidansec%2Fphp-parsing-domain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zidansec%2Fphp-parsing-domain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zidansec%2Fphp-parsing-domain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zidansec%2Fphp-parsing-domain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zidansec","download_url":"https://codeload.github.com/zidansec/php-parsing-domain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252755256,"owners_count":21799281,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","api-rest","domain-data","domain-extractor","domain-name","php","php-cheatsheet","php-functions"],"created_at":"2024-10-29T17:22:24.565Z","updated_at":"2025-05-06T19:41:04.761Z","avatar_url":"https://github.com/zidansec.png","language":"PHP","funding_links":["https://paypal.me/zidansec"],"categories":[],"sub_categories":[],"readme":"# PHP Parsing Domain Or Subdomain\nSimple PHP code for parsing domains, automatically fetching the TLD of the domain or subdomain.\n```php\nfunction get_domain($url) {\n  $str = '/^(?:https?.\\/\\/)?(?:[^@\\/\\n]+@)?(?:)?([^:\\/?\\n]+).*/m';\n  preg_match_all($str, $url, $matches, PREG_SET_ORDER, 0);\n  foreach ($matches as $key =\u003e $value) {\n    //var_dump($value);\n    return $value[1];\n  }\n}\n```\n# Usage: result of parsing domain\n\u003e Use the following function: ``get_domain``\n```php\nget_domain(\"https://www.domain.com/login/admin.php?login\u0026username=admin\u0026password=admin\u0026submit=login\");\n```\nResults of parsing domains, extracting domains and subdomains.\n```php\necho get_domain(\"https://www.domain.com/login/admin.php?login\u0026username=admin\u0026password=admin\u0026submit=login\"); // www.domain.com\necho get_domain(\"https://domain.com/login/admin.php?login\u0026username=admin\u0026password=admin\u0026submit=login\"); // domain.com\necho get_domain(\"http://www.domain.com/login/admin.php?login\u0026username=admin\u0026password=admin\u0026submit=login\"); // www.domain.com\necho get_domain(\"http://domain.com/login/admin.php?login\u0026username=admin\u0026password=admin\u0026submit=login\"); // domain.com\necho get_domain(\"www.domain.com/login/admin.php?login\u0026username=admin\u0026password=admin\u0026submit=login\"); // www.domain.com\necho get_domain(\"domain.com/login/admin.php?login\u0026username=admin\u0026password=admin\u0026submit=login\"); // domain.com\necho get_domain(\"www.dom-ain.com/login/admin.php?login\u0026username=admin\u0026password=admin\u0026submit=login\"); // www.dom-ain.com\necho get_domain(\"dom-ain.com/login/admin.php?login\u0026username=admin\u0026password=admin\u0026submit=login\"); // dom-ain.com\n\necho get_domain(\"https://www.domain.com/demo/assets/css/\"); // www.domain.com\necho get_domain(\"https://domain.com/demo/assets/css/\"); // domain.com\necho get_domain(\"http://www.domain.com/demo/assets/css/\"); // www.domain.com\necho get_domain(\"http://domain.com/demo/assets/css/\"); // domain.com\necho get_domain(\"www.domain.com/demo/assets/css/\"); // www.domain.com\necho get_domain(\"domain.com/demo/assets/css/\"); // domain.com\necho get_domain(\"www.dom-ain.com/demo/assets/css/\"); // www.dom-ain.com\necho get_domain(\"dom-ain.com/demo/assets/css/\"); // dom-ain.com\n\necho get_domain(\"https://www.domain.com\"); // www.domain.com\necho get_domain(\"https://domain.com\"); // domain.com\necho get_domain(\"http://www.domain.com\"); // www.domain.com\necho get_domain(\"http://domain.com\"); // domain.com\n```\n# Donations for developers: https://paypal.me/zidansec\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzidansec%2Fphp-parsing-domain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzidansec%2Fphp-parsing-domain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzidansec%2Fphp-parsing-domain/lists"}