how to extract a link from a string containg two links

Discussion in 'PHP' started by kmap, Oct 19, 2008.

  1. #1
    My string is like this

    $str="http://www.abc.com/tt.php?aa=http://www.xyz.com/abc.doc"

    I want to extract the second url out of it

    if the string is a normal link then the code should not change it,only if it has two http it shd extarct the second url of it

    Regards

    Alex
     
    kmap, Oct 19, 2008 IP
  2. Kyosys

    Kyosys Peon

    Messages:
    226
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <?php
    $a = "http://test.com/a.php?x=http://google.com";
    $a = substr($a,strrpos($a,"http://"));

    ?>
     
    Kyosys, Oct 19, 2008 IP
  3. rohan_shenoy

    rohan_shenoy Active Member

    Messages:
    441
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60