Getting the full page URL in PHP

Discussion in 'PHP' started by Seqqa, Jun 17, 2010.

  1. #1
    Hey Everyone,

    I'm trying to get the URL to use on my FBshare button. I want to be able to the full address like and past it like the example below.

    URL: http://www.example.com/keyword-keyword-keyword

    <iframe src="http://www.facebook.com/plugins/like.php?href=http://www.example.com/keyword-keyword-keyword&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>
    HTML:
    Any help would be great thanks!

    Chris
     
    Seqqa, Jun 17, 2010 IP
  2. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #2
    <?php
    echo "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    ?>
    PHP:
     
    danx10, Jun 17, 2010 IP
    Seqqa likes this.
  3. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #3
    That Right

    BTW:
    OP heres it

    
    <?php
    <?php
    $full_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    ?>
    
    <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo $full_url; ?>&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>
    
    
    PHP:
     
    roopajyothi, Jun 18, 2010 IP