Does anyone know a good way of extracting the second url out of this link? http://localhost/somesite/index.php/login/index/http://www.asdasd.as.com/asd?=asdas It should get out : http://www.asdasd.as.com/asd?=asdas I tried some regex but I suck so bad. Thanks.
You can try: $link = "http://localhost/somesite/index.php/login/index/http://www.asdasd.as.com/asd?=asdas"; list($junk1, $junk2, $newlink) = explode("//", $link); echo "http://$newlink"; PHP:
$link = "http://localhost/somesite/index.php/login/index/http://www.asdasd.as.com/asd?=asdas"; echo strrchr($link, 'http:'); PHP: