V Posted August 21, 2010 Share Posted August 21, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/211376-adding-query-string-to-any-url/ Share on other sites More sharing options...
hoogie Posted August 21, 2010 Share Posted August 21, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/211376-adding-query-string-to-any-url/#findComment-1102136 Share on other sites More sharing options...
kenrbnsn Posted August 21, 2010 Share Posted August 21, 2010 What are you trying to accomplish? Ken Quote Link to comment https://forums.phpfreaks.com/topic/211376-adding-query-string-to-any-url/#findComment-1102137 Share on other sites More sharing options...
V Posted August 21, 2010 Author Share Posted August 21, 2010 @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. Quote Link to comment https://forums.phpfreaks.com/topic/211376-adding-query-string-to-any-url/#findComment-1102143 Share on other sites More sharing options...
hoogie Posted August 21, 2010 Share Posted August 21, 2010 @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. Quote Link to comment https://forums.phpfreaks.com/topic/211376-adding-query-string-to-any-url/#findComment-1102166 Share on other sites More sharing options...
V Posted August 21, 2010 Author Share Posted August 21, 2010 Yes, I have control on the other sites just for the variable. Quote Link to comment https://forums.phpfreaks.com/topic/211376-adding-query-string-to-any-url/#findComment-1102172 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.