Question: I want to change this url from:

```
https://lh3.googleusercontent.com/-5EoWQXUJMiA/VZ86O7eskeI/AAAAAAADHGs/ej6F-va__Ig/s1600/i2Fun.com-helpful-dogs-015.gif

```

to this:

```
http://3.bp.blogspot.com/-5EoWQXUJMiA/VZ86O7eskeI/AAAAAAADHGs/ej6F-va__Ig/s1600/i2Fun.com-helpful-dogs-015.gif

```

This is my code, but it's not working as expected:

```
$link = preg_replace('#^https?://.*?/(.+?/)(s\d+/)?([\w_-]+\.[\w]{3,})?$#i','http://3.bp.blogspot.com/$1s0/$3',$url);

```

Answer: 
It's a simple string replace.

Search for `"https://lh3.googleusercontent.com/"`. Replace with `"http://3.bp.blogspot.com/"`.

`str_replace()` will do this. Am I missing something?
```
$s = "https://lh3.googleusercontent.com/-5EoWQXUJMiA/VZ86O7eskeI/AAAAAAADHGs/ej6F-va__Ig/s1600/i2Fun.com-helpful-dogs-015.gif"; 
$path = parse_url($s);

echo 'http://3.bp.blogspot.com' . $path['path'];

```

**UPDATE** You can don't receive all the parts of an url, but take only the needed part

```
echo 'http://3.bp.blogspot.com' . parse_url($s, PHP_URL_PATH);

```