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 =]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.