-3

I have a host of files that generate link like this for hosted files:

http://endertec.com.br/hf/see-img.php?img=http://www.endertec.com.br/hf/do.php?imgf=Fav2.png

But when I see link like this on Facebook, it looks like this:

http://endertec.com.br/hf/see-img.php?img=http%3A%2F%2Fwww.endertec.com.br%2Fhf%2Fdo.php%3Fimgf%3Fav2.png

So I researched ways to convert it, and got the following code:

<?php
    $str = 'http://www.endertec.com.br'.$_SERVER['REQUEST_URI'];
    $src = str_replace('see-img.php?img=' , '' ,stristr($str , 'see-img.php?img='));
    string rawurldecode ( string $src )
    echo '<img src="'.$src.'"/>';
?>

But for some reason it does not work, does anyone know how it might work?

Amal Murali
  • 75,622
  • 18
  • 128
  • 150
  • 1
    `string rawurldecode ( string $src )` copy&pasting this _syntax description_ from the manual into actual code is of course total nonsense. You need to go learn some basics first. – CBroe May 27 '14 at 03:12
  • See [How to read a function definition (prototype)](http://www.php.net/manual/en/about.prototypes.php) – Amal Murali May 27 '14 at 03:14
  • Tim's code works, but I will read this article to learn more about it. Thanks for answering! – RenatoBDCS May 27 '14 at 03:35

1 Answers1

0

You need to store your rawurldecode in something.. try something like this:

$decoded_src = rawurldecode($src);
echo '<img src="'.$decoded_src.'" />';
Tango Bravo
  • 3,221
  • 3
  • 22
  • 44