How to copy a part of the link into php script

Discussion in 'PHP' started by kapaionutz, Jan 14, 2012.

  1. #1
    Hy guys, I need your help :)

    I managed to get the youtube link of the youtube videos that are posted on my website, now i need to get it to a website where the user can convert it
    so, this is how the link is:
    http://www.tralala.boom/test.php?url=http://www.youtube.com/watch?v=b57AHID-_3k&hq=1
    Code (markup):
    i want to create a link in test.php that contains a part of the url
    something like this:
    http://www.conversionewebsite.org/?url=http://www.youtube.com/watch?v=b57AHID-_3k&hq=1
    Code (markup):
    Thanks in advance :D
     
    Solved! View solution.
    kapaionutz, Jan 14, 2012 IP
  2. #2
    In test.php:

    
    <?php
    $ytURL = $_GET['url'];
    $conversionURL = "http://www.conversionewebsite.org/?url=$ytURL";
    
    // choose only one of these:
    header("Location: $conversionURL"); // if you want to redirect the user to the conversion website
    echo $conversionURL; // if you only want to print the conversion website's URL
    
    exit();
    
    ?>
    
    
    PHP:
    It should work.
     
    Last edited: Jan 15, 2012
    modz, Jan 15, 2012 IP
    kapaionutz likes this.
  3. kapaionutz

    kapaionutz Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks allot modz, you really made my day!:cool:
     
    kapaionutz, Jan 15, 2012 IP