php - Remove Subdomains from Form Post -
How do I go about removing just the base URL from a base string that was inserted into a form?
Example: User Input: http://stackoverflow.com/question/ask/asdfasneransea Required program only: http://stackoverflow.com What is the easiest way to use / no / code / PHP / PHP?
You can use just
$ url = parse_url ('http://example.com/foo/bar'); $ Host = $ url ['Host']; // example.com
Comments
Post a Comment