Rahul Rahul - 1 year ago 63
PHP Question

PHP to get element from link

I have below code:-

$link = 'http://www.domain.com/go.php?id=545&url=http://www.example.com/about


I want URL element that is - http://www.example.com/about

Answer Source
$link = 'http://www.domain.com/go.php?id=545&url=http://www.example.com/about';

$url = explode("&url=", $link)[1];
echo $url; //http://www.example.com/about