php - Cannot get the full value of a URL passed in the query string -


i want send url page this:

http://localhost/l.php?u=http://www.simplesite.com?view=photo&id=13

where url http://www.simplesite.com?view=photo&id=13 value of parameter u.

in l.php file result looks this:

echo $_get['u']; // http://www.simplesite.com?view=photo                  // &id=13 missing 

what wrong this? want redirect url http://www.simplesite.com?view=photo&id=13, &id=13 part missing.

i create links preg_replace. cannot apply php function $1 variable

preg_replace("/(https?:\/\/[\w-?#&;~=\.\/\@]+[\w\/])/i","<a target=\"_blank\"  href=\"l.php?u=$1\">$1</a>",$text); 

try code:

preg_replace_callback("/(https?:\/\/[\w-?#&;~=\.\/\@]+[\w\/])/i", function($m){     return "<a target='_blank' href='l.php?u=".urlencode($m[0])."'>".$m[0]."</a>"; }, $text); 

this replace links anchor tags & encode url well.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -