Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Parse out a parameter in a url (PHP)

Avatar of webgeek154
webgeek154Flag for United States of America asked on
Web Languages and StandardsPHP
6 Comments1 Solution301 ViewsLast Modified:
Hi Experts!

I'm trying to parse out a certain parameter in the string stored at $_SERVER['HTTP_REFERER'].

Here's are examples of what that string looks like:

http://www.google.com/search?hl=en&q=marriage+problems&revid=486951557&sa=X&oi=revisions_inline&resnum=0&ct=top-revision&cd=1

http://www.google.com/search?sourceid=navclient&ie=UTF-8&rlz=1T4HPND_enUS213US214&q=relationship+counseling+sturbridge

http://www.google.com/search?hl=en&q=marriage+counseling

The parameter of interest is 'q'.  I want to grab that parameter and store it into $_SESSION['query']

I know I can figure this out on my own but it would probably take me hours to figure out and it would probably be a sub-optimal solution.

Thanks!
John