Exforsys
+ Reply to Thread
Results 1 to 4 of 4

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 ...

  1. #1
    Mainutz 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


  2. #2
    Chase C Guest
    Ohh ok..preg_match ---EDIT---Rasmah, he wants to extract the domain from a url, not just echo them..


  3. #3
    steve.zaptech is offline Junior Member Array
    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"];


  4. #4
    Sam Jepsum is offline Member Array
    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



Latest Article

Network Security Risk Assessment and Measurement

Read More...