View Full Version : Small Str_Replace Problem

01-06-2010, 09:02 PM
I am trying to send a URL to a webpage like the following:

This I have got working fine but when there are additional variables in the second URL this is when problems occur, E.g.

So Instead of doing it like this (I am the original person that sends the URL data in the URL) I have changed it so that I search and replace all &'s with ;'s before it is sent with the following:

$url = $subfetch['link'];
$url = str_replace("&",";",$url);
header ("location:".$url);

But for some reason it is not replacing the & symbols. I can see in my browser that the next page says:

Instead of replacing the &'s with ;'s.

Can anyone see what I am doing wrong here or know of an alternative way to obtain a URL from a URL like this?

01-06-2010, 09:09 PM
You are going about this the wrong way. I suggest that you use urlencode to encode the url so the url query string goes through fine then whatever site you need to get the url variable from just use urldecode.