Re: inserting parameters into URLs dynamically
| From: | Ernest E Vogelsinger | Date: | Fri, 14 Mar 2003 21:45:44 +0000 |
| Subject: | Re: inserting parameters into URLs dynamically | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139766@lists.php.net to get a copy of this message | ||
At 22:31 14.03.2003, Maureen Roihl said:
--------------------[snip]--------------------
>- find a way for PHP to automatically tack the parameters onto the ends
>of url querystrings, the same way it can do with PHPSESSIONID (we haven't
>found, in our initial research, a way to do this)
>
>Our primary goal is to get these parameters logged in the weblogs, without
>having to programmatically/physically modify every link on our site. For
>example, if we wanted to track parameters called x and y, the link on the
>page would just point to:
>
>/index.php
>
>but the weblog would show something like the following hit:
>
>/index.php?x=foo&y=bar
>
>The parameter values would need to get set once at the beginning of a user's
>session, and then would not change over the course of that session (but
>they'd need to get tracked with every request they made). We're planning to
>implement persistent sessions across our servers as well.
--------------------[snip]--------------------
PHP implements href rewriting in the final stage of output. You could
easily hook in here using output buffering.
ob_start('weblogize_links');
function weblogize_links($buffer)
{
// parse the output $buffer and modify all links
}
A special gotcha may come in here: take care to only rewrite links that
point to your own site.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/