[RESOLVED] Best way to parse URLs for GET variables?
I've been searching but cannot find an answer (only how to use $_GET[]).
Basically I have a log file of hundreds of URLs. Each URL has many GET variables. How can I extract the contents of those variables without being on that page?
For instance, let's say I have the following URL in a log file:
PHP Code:
http://vbforums.com/newthread.php?do=newthread&f=27
Let's say the next URL looks like this:
PHP Code:
http://vbforums.com/newthread.php?f=27&do=newthread
Now to newthread.php, they mean the samething. It passes the f and do variables with the contents of 27 and newthread. But how do I get the contents of those variables reliably from a completely different page with only the URL given to me?
(In case anyone was wondering, I'm parsing through a Google-Mini server's logs and need to extract contents out of URLs)
Re: Best way to parse URLs for GET variables?
have you looked at parse_url()?
Re: Best way to parse URLs for GET variables?
With a little hacking you can also modify this function which splits the query string into its name/variable pairs.
http://www.vbforums.com/showpost.php...20&postcount=5
Re: Best way to parse URLs for GET variables?
Quote:
Originally Posted by john tindell
Perfect, thanks!