
- Forum
- Programming Talk
- PHP
- PHP help please?
PHP help please?
This is a discussion on PHP help please? within the PHP forums, part of the Programming Talk category; I have this (just an example):var first="www.mysite.com?id=3&q=nice+game ";and I want:var second="www.mysite.com" How can I do that ?I mean, extract only ...
-
01-19-2008, 11:26 AM #1Mainutz M Guest
PHP help please?
I have this (just an example):var first="www.mysite.com?id=3&q=nice+game ";and I want:var second="www.mysite.com" How can I do that ?I mean, extract only the domain from that url
-
01-19-2008, 11:27 AM #2Chase C Guest
Ohh ok..preg_match
---EDIT---Rasmah, he wants to extract the domain from a url, not just echo them..
-
01-28-2010, 05:06 AM #3
- Join Date
- Jan 2010
- Answers
- 2
Following code will help you.......
By using the following code you will get the domain name from the url.........
echo $_SERVER["SERVER_NAME"];
-
12-10-2010, 02:02 PM #4
- Join Date
- Dec 2010
- Answers
- 34
This does not always work as the Server name set in Apache does not always match the URL... just a heads up!
-
Sponsored Ads

Reply With Quote





