Jump to content

Passing URL into php file (via GET) which contains variables


RamboJustRambo

Recommended Posts

Hi,

 

basically i have a php file which takes an input as a url (such as "

http://www.test.com/index.php?name=andy&friend=john

")

 

However,whenever i pass this into my php file via $_GET, i end up with:

 

http://www.mysite.com/file.php?site=http://www.test.com/index.php?name=andy&friend=john

 

which my PHP doesn't like. Ifi hard code the link as a variable, it's fine, but since this is impossible to work with.

 

Anyone have a work around?

 

I don't need to access the variables, just accept the URL as an input for the file.

 

Thanks for any help =]

Not tested.

 

$encoded_site = urlencode("http://www.test.com/index.php?name=andy&friend=john");
$pass = "http://www.mysite.com/file.php?site=".$encoded_site;
echo $pass; //may have to use echo urldecode($pass) to view properly

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.