Query Strings, extract() and including pages

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Query Strings, extract() and including pages

    I wanted to do:
    include('page.htm?id=12&foo=bar');

    But since I can't (and don't want to make another seperate HTTP request
    with include('http://...')); I was wondering if there's a function
    similar to extract(); that can handle a query string as input, so that I
    could:
    $id = 12;
    $foo = 'bar';
    include('page.htm');

    I am using this on a 'processor' style page to interperet URLs as
    [url]http://foo.com/bla[/url]. It consults a database to manage a large number of
    URLs to their pages.

    Logical Guest

  2. Similar Questions and Discussions

    1. Isolate and extract pages from large doc....
      Hey all, sorry to ask for help in first post but I am stuck with a big problem that could be made way easier if only... 1. I have a 136 page pdf....
    2. Extract Pages help......
      I have a 80 page InDesign CS Document that I have exported to a PDF. I need to extract this to separate PDF files in order to process through our...
    3. Extract separate pages of a pdf file
      Is there any way that I can "automatically" separate a 60 page pdf file into 60 separate pdf files? This is a function that I will use a lot. If...
    4. extract strings between alternating text
      hi there, i want to extract the numbers from this example input: bla trigger3 trigger4 trigger1 blabla trigger1 5000.00 trigger3 trigger1...
    5. Query apache and URL query strings
      Our website uses the standard query string arrangement: something.php?this=1&that=2 We're in the process of moving over to an alternate...
  3. #2

    Default Re: Query Strings, extract() and including pages

    Logical wrote:
    > I wanted to do:
    > include('page.htm?id=12&foo=bar');
    >
    > But since I can't (and don't want to make another seperate HTTP request
    > with include('http://...')); I was wondering if there's a function
    > similar to extract(); that can handle a query string as input, so that I
    > could:
    > $id = 12;
    > $foo = 'bar';
    > include('page.htm');
    In your included file, you can use:

    global $id, $foo;

    And you'll be able to use those variables just like any other variable.

    --
    Pieter Nobels
    Pieter Nobels Guest

  4. #3

    Default Re: Query Strings, extract() and including pages


    "Logical" <me@privacy.net> wrote in message
    news:4119f186$0$31716$61c65585@un-2park-reader-01.sydney.pipenetworks.com.au...
    > I wanted to do:
    > include('page.htm?id=12&foo=bar');
    >
    > But since I can't (and don't want to make another seperate HTTP request
    > with include('http://...')); I was wondering if there's a function
    > similar to extract(); that can handle a query string as input, so that I
    > could:
    > $id = 12;
    > $foo = 'bar';
    > include('page.htm');
    >
    > I am using this on a 'processor' style page to interperet URLs as
    > [url]http://foo.com/bla[/url]. It consults a database to manage a large number of
    > URLs to their pages.
    >
    Don't quite understand what you're trying to do, but I think parse_str() is
    what you're looking for.


    --
    Obey the Clown - [url]http://www.conradish.net/bobo/[/url]


    Chung Leong Guest

  5. #4

    Default Re: Query Strings, extract() and including pages

    Pieter Nobels wrote:
    > Logical wrote:
    >
    >> I wanted to do:
    >> include('page.htm?id=12&foo=bar');
    >>
    >> But since I can't (and don't want to make another seperate HTTP
    >> request with include('http://...')); I was wondering if there's a
    >> function similar to extract(); that can handle a query string as
    >> input, so that I could:
    >> $id = 12;
    >> $foo = 'bar';
    >> include('page.htm');
    >
    > In your included file, you can use:
    >
    > global $id, $foo;
    >
    > And you'll be able to use those variables just like any other variable.
    Isn't global-ing variables like that not required?
    <http://www.php.net/manual/en/language.variables.scope.php>

    I'm actually more concerned about how to get $id and $foo 'out of' the
    query string attached to the URL (this part: page.htm?id=12&foo=bar).
    Logical Guest

  6. #5

    Default Re: Query Strings, extract() and including pages

    Chung Leong wrote:
    > "Logical" <me@privacy.net> wrote in message
    > news:4119f186$0$31716$61c65585@un-2park-reader-01.sydney.pipenetworks.com.au...
    >
    >>I wanted to do:
    >>include('page.htm?id=12&foo=bar');
    >>
    >>But since I can't (and don't want to make another seperate HTTP request
    >>with include('http://...')); I was wondering if there's a function
    >>similar to extract(); that can handle a query string as input, so that I
    >>could:
    >>$id = 12;
    >>$foo = 'bar';
    >>include('page.htm');
    >>
    >>I am using this on a 'processor' style page to interperet URLs as
    >>[url]http://foo.com/bla[/url]. It consults a database to manage a large number of
    >>URLs to their pages.
    >>
    >
    >
    > Don't quite understand what you're trying to do, but I think parse_str() is
    > what you're looking for.
    >
    >
    parse_str(), that's it!
    Thanks.
    Logical Guest

  7. #6

    Default Re: Re: Query Strings, extract() and including pages

    "Logical" wrote:
    > Pieter Nobels wrote:
    > > Logical wrote:
    > >
    > >> I wanted to do:
    > >> include(’page.htm?id=12&foo=bar’);
    > >>
    > >> But since I can’t (and don’t want to make another
    > seperate HTTP
    > >> request with include(’[url]http://...’));[/url] I was
    > wondering if there’s a
    > >> function similar to extract(); that can handle a query string
    > as
    > >> input, so that I could:
    > >> $id = 12;
    > >> $foo = ’bar’;
    > >> include(’page.htm’);
    > >
    > > In your included file, you can use:
    > >
    > > global $id, $foo;
    > >
    > > And you’ll be able to use those variables just like any
    > other variable.
    >
    > Isn’t global-ing variables like that not required?
    > <http://www.php.net/manual/en/language.variables.scope.php>
    >
    > I’m actually more concerned about how to get $id and $foo
    > ’out of’ the
    > query string attached to the URL (this part:
    > page.htm?id=12&foo=bar).
    When you include a file, it inherits the scope of variables at the
    point of inclusion. It means that $id and $foo are available to the
    included script already. You would need to declare them as global
    only if your include is a function.

    steve

    --
    [url]http://www.dbForumz.com/[/url] This article was posted by author's request
    Articles individually checked for conformance to usenet standards
    Topic URL: [url]http://www.dbForumz.com/PHP-Query-Strings-extract-including-pages-ftopict138606.html[/url]
    Visit Topic URL to contact author (reg. req'd). Report abuse: [url]http://www.dbForumz.com/eform.php?p=466974[/url]
    steve Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139