Jump to content

Adding query string to any URL


V

Recommended Posts

Is it possible to add a query string for example some_var=jk84 to any sort of link be it, http://www.website.com , http://www.website.com/?some_id=4, or http://www.website.com/post=45&category=9 or http://www.website.com/somepost/ ?

 

While adding that extra query string how can I make sure I'm not affecting the website's content or causing some script error?

Link to comment
https://forums.phpfreaks.com/topic/211376-adding-query-string-to-any-url/
Share on other sites

You can add as many variables to a url as you want.  The only danger is unknowingly using a variable that is already being used for something else.  If you are developing this website yourself, you should make sure you do your research and find out all the variables that it uses before you add more.  If the website is being developed by someone else, you should talk to them to make sure your variable isn't going to interfere with what they're doing.

@hoogie thanks for the reply! That makes sense :) I should probably think of a way to automatically create a non-existing variable.

 

@kenrbnsn, I'm trying to send URL requests to some websites but their URL may vary in parameters. One might be ...somesite.com?existing_var=1234

 

or somesite.com?existing_var=1234&another_var=789

 

so I'm trying to figure if I can add for example, ?my_var=345 at the end of any link without getting script errors and successfully using GET on the sites I added the new parameter.

@hoogie thanks for the reply! That makes sense :) I should probably think of a way to automatically create a non-existing variable.

 

@kenrbnsn, I'm trying to send URL requests to some websites but their URL may vary in parameters. One might be ...somesite.com?existing_var=1234

 

or somesite.com?existing_var=1234&another_var=789

 

so I'm trying to figure if I can add for example, ?my_var=345 at the end of any link without getting script errors and successfully using GET on the sites I added the new parameter.

 

You can do this, but you won't be able to do anything with the my_var variable unless you also control somesite.com.  Does that make sense?  You can pass any sort of variable to any site you want to, but unless you also control the site you're passing the variable to, it will just ignore it.

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.