Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do a question mark (?) and an ampersand (&) mean in a URL?

Tags:

url

I saw a link like this:

https://www.google.com/recaptcha/api/siteverify?secret=YOUR_SITE_KEY&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);

I know that it's setting the secret variable to YOUR_SITE_KEY and response to response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR'] but, I'm not sure what those symbols means that is, the ? and & in the query string.

like image 593
Arnar Freyr Avatar asked Jul 07 '16 18:07

Arnar Freyr


1 Answers

There isn't really anything there that is particular to PHP.

The ? indicates the start of the query string. Within the query string you have a set of key=value pairs, each separated by an &.

PHP will populate $_GET with this data. It is part of the URL standard and any server side language will have a parser that provides similar functionality.

This is also the default data format browsers generate when submitting a form.

like image 64
Quentin Avatar answered Nov 15 '22 22:11

Quentin