.php?url=http://site.com url error

Discussion in 'PHP' started by jonhyhar, Nov 14, 2009.

  1. #1
    How can i change a code that looks like this:

    
    http://www.site.com/bm.php?u=http%3A%2F%2Fwww.digitalpoint.com
    
    Code (markup):
    to look like this:


    <div>
    <a href='<?php echo "http://facebook.com/share.php?u=$url"; ?>'>
    Url'ye git</a></div>
    Code (markup):

    I've tried a code that looks like this:


    <?php
    $url = urldecode($HTTP_GET_VARS[u]);
    ?>
    Code (markup):
    but i get an error saying:

    --------
    Forbidden
    You don't have permission to access /bm.php on this server.
    -------
     
    jonhyhar, Nov 14, 2009 IP
  2. stuart

    stuart Guest

    Messages:
    184
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    works ok for me

    <?php
    $url = "http://www.site.com/bm.php?u=http%3A%2F%2Fwww.digitalpoint.com";
    $url2 = urldecode($url);
    echo $url."<br>\n";
    echo $url2."<br>\n";
    ?>
    PHP:
     
    stuart, Nov 14, 2009 IP
  3. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #3
    Forbidden message is result of misconfiguration of your webserver or restriction in .htaccess file.

    Maybe this helps:
    
    <div>
    <a href='http://facebook.com/share.php?u=<?php echo urlencode($_GET['url']); ?>'>
    Url'ye git</a></div>
    
    PHP:
     
    AsHinE, Nov 14, 2009 IP