PHP - Preprocessing Filters using wildcards on URL path

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TATrader

    #1

    PHP - Preprocessing Filters using wildcards on URL path

    Dearest Colleagues,

    I was suddenly having a sharp pain in locating information about a
    design capability in PHP that exists in Java servlets.

    In Java, I can preprocess, via a filter, some HTTP requests before
    answering to the client. Please allow me to show and example since it
    will illustrate the point well.

    User types: http://domain.com/myapp/restofpath.html
    In a Java servlet, there exists a web-app which maps /myapp/* to a
    cookie checking filter before routing it to restofpath.html .

    Of course, the filter could do many other actions, so the method of
    interest here is whether there is any similar thing that may be
    achieved with PHP? Also if anyone knows what it would be called I'd
    appreciate, so web searches turn up better results to me.

    So it boils down to, in PHP how can I route all paths matching a
    pattern to a PHP script prior to them serving the page immediately?
    the end result is not a single script, however I'd like all the
    requests to go through a single script prior to hitting the resulting
    page.

    User types: http://domain.com/myapp/restofpath.html
    User types: http://domain.com/myapp/adifferentpath.html
    User types: http://domain.com/myapp/garycoleman.html

    The objective would be to route all these through myfilter.php to pre-
    process the request (and maybe do things like cookie processing, page
    view counters, and http header info)

    Thank you for your time and thoughts!

  • Jerry Stuckle

    #2
    Re: PHP - Preprocessing Filters using wildcards on URL path

    TATrader wrote:
    Dearest Colleagues,
    >
    I was suddenly having a sharp pain in locating information about a
    design capability in PHP that exists in Java servlets.
    >
    In Java, I can preprocess, via a filter, some HTTP requests before
    answering to the client. Please allow me to show and example since it
    will illustrate the point well.
    >
    User types: http://domain.com/myapp/restofpath.html
    In a Java servlet, there exists a web-app which maps /myapp/* to a
    cookie checking filter before routing it to restofpath.html .
    >
    Of course, the filter could do many other actions, so the method of
    interest here is whether there is any similar thing that may be
    achieved with PHP? Also if anyone knows what it would be called I'd
    appreciate, so web searches turn up better results to me.
    >
    So it boils down to, in PHP how can I route all paths matching a
    pattern to a PHP script prior to them serving the page immediately?
    the end result is not a single script, however I'd like all the
    requests to go through a single script prior to hitting the resulting
    page.
    >
    User types: http://domain.com/myapp/restofpath.html
    User types: http://domain.com/myapp/adifferentpath.html
    User types: http://domain.com/myapp/garycoleman.html
    >
    The objective would be to route all these through myfilter.php to pre-
    process the request (and maybe do things like cookie processing, page
    view counters, and http header info)
    >
    Thank you for your time and thoughts!
    >
    You can't. All you can do is include the code in the appropriate files.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    Working...