I have a Facebook link string:
"https://www.facebook.com/v2.5/dialog/oauth?client_id=*****&state=*****&response_type=code&sdk=php-sdk-5.1.2&redirect_uri=http%3A%2F%2Flocalhost%3A8888%2Ffacebook%2Flink&scope=email%2Cuser_birthday%2Cuser_photos"
I want to replace:
redirect_uri=http%3A%2F%2Flocalhost%3A8888
to
redirect_uri=http%3A%2F%2Flocalhost
I would do something like this if it's the browser URL, but it is a string inside a anchor tag.
if (isset($_GET['redirect_uri'])) {
    echo $_GET['redirect_uri'];
}else{
    // Fallback behaviour goes here
}
How do I do something like that?
I've tried
$permissions = 'user_birthday,user_photos';
$login_url = $fb->getLoginUrl(['email','scope'=>$permissions]);
$urls = explode("&", $login_url);
$redirect_uri = explode("=", $urls[4]);
$link = explode("%2F", $redirect_uri[1]);
dd($link);
// array:5 [▼
//   0 => "http%3A"
//   1 => ""
//   2 => "localhost%3A8888" // I want to replace this string with 'localhost'
//   3 => "facebook"
//   4 => "link"
// ]