I am trying to extract a portion of a URL using regex.
An example of my url would be:
http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=food
Using php, how could I extract the data in the q variable or the sourceid variable?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Don’t use a regex for this. Instead, use
parse_url()andparse_str().Demo