PDA

Click to See Complete Forum and Search --> : [RESOLVED] Best way to parse URLs for GET variables?


Kasracer
May 31st, 2006, 01:30 PM
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:

http://vbforums.com/newthread.php?do=newthread&f=27

Let's say the next URL looks like this:

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)

john tindell
May 31st, 2006, 01:36 PM
have you looked at parse_url() (http://uk2.php.net/manual/en/function.parse-url.php)?

visualAd
May 31st, 2006, 03:29 PM
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?p=2453020&postcount=5

Kasracer
May 31st, 2006, 10:24 PM
have you looked at parse_url() (http://uk2.php.net/manual/en/function.parse-url.php)?
Perfect, thanks!