You can use parse_url to get down to the hostname.
e.g.:
$url = "http://localhost/path/to/?here=there";
$data = parse_url($url);
var_dump($data);
/*
Array
(
[scheme] => http
[host] => localhost
[path] => /path/to/
[query] => here=there
)
*/
More Related Contents:
- Undefined Offset Array [closed]
- How to access and manipulate multi-dimensional array by key names / path?
- How to call a PHP function on the click of a button
- Get all permutations of a PHP array?
- How can I get useful error messages in PHP?
- Is possible to keep session even after the browser is closed?
- How to get rid of eval-base64_decode like PHP virus files?
- PHP file listing multiple file extensions
- PHP: Check if a file is loaded directly instead of including?
- Sanitizing user’s data in GET by PHP [duplicate]
- What is the right way to handle $_POST data in MVC?
- How do I loop through a MySQL query via PDO in PHP?
- PHP production server – turn on error messages
- Highlight keywords in a paragraph
- How to access a property of an object (stdClass Object) member/element of an array? [duplicate]
- Live Video Streaming with PHP
- PDO try-catch usage in functions
- How to manage a single PHP5 session on multiple apache servers?
- XML Parse Error – Extra content at the end of the document
- Using SimpleXML to create an XML object from scratch
- Get value of dynamically chosen class constant in PHP
- PHP best practices for user authentication and password security
- How to find timezone ID from IP address/country name in PHP?
- Can I do a CURL request to the same server?
- how to embed html files in php code?
- How do I save PHP session data to a database instead of in the file system?
- Escaping SQL queries in Codeigniter
- displaying a message after redirecting the user to another web page [duplicate]
- How to call a php function from ajax?
- Sending XML data using HTTP POST with PHP