I’ve found a few keyword extractors for query strings, but they all seem to be outdated (use deprecated code or simply don’t work).
Does anyone know of a php query string extractor. Or how would I build a function that takes a “host” like “amazon.com” and the names of multiple query parameters and returns the values of those parameters?
For instance, http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=a+tale+of+two+cities&x=0&y=0
If I provided “amazon.com” and “field-keywords” how can I get the array: ['a','tale','of','two','cities'] ?
Thanks in advance!!
Clarification
Jose’s answer covers my example for Amazon but doesn’t seem to work for any other URL:
http://www.bing.com/search?q=Christmas+Around+The+World&form=QBLH&qs=PN&sk=HS1PN4&pq=&sp=6&sc=8-0
http://search.yahoo.com/search;_ylt=AnQN0c997QR5SIYcYt.h2YCbvZx4?p=golf&toggle=1&cop=mss&ei=UTF-8&fr=yfp-t-701
You (I) could write one.
Just a tad of code stolen from @Jose’s answer 🙂
Update: tested, didn’t work, fixed, works.
Update 2: didn’t work after all, tested, fixed, works.
Update 3: added support for HTTPS