September 8, 200520 yr How do I capture the current query that got me to a particular php page? ie. if the url in the header is: http://domain.com/publist.php?name=tree&year=2005 And I want to capture the part of the url past the '?' something like this: $query = parse_url(['query']); in old cdml it was using the FMP-Link command and in perl it is $ENV{'QUERY_STRING'} So what small part am I missing? Thanks
September 8, 200520 yr Author further to this, I am trying to get the query from a 'POST' form rather than a 'GET' so all variables are hidden. I think there must be something I can do with $_REQUEST The goal is to take the variables from one page and send the variables (query) to another PHP page.
September 12, 200520 yr Author Thanks Gary, $_SERVER["QUERY_STRING"] works excellent for 'GET' but if for security I want to use 'POST' on the form and keep all fields hidden, that won't work. So then I am left with having the $_REQUEST capturing all the fields (GET, POST, COOKIE) and wanting to send those fields to a new PHP page. Page1.php takes all the data from a form via POST. All the fields are hidden, so the only way I see is to use $_REQUEST or $_POST. I then want take those fields and keep them hidden and send them to a second page (Page2.php). So... please help with the following and feel free to make corrections. I might try to take the array $_POST and save it to a new array. $variables = $_POST; I then might try the following to pass it to the new page.
September 13, 200520 yr For a POST I've used this before: $args = ""; while ($fm_params = Current($_REQUEST)) { $args .= urlencode(key($_REQUEST)) . "=" . urlencode($fm_params) . "&"; next($_REQUEST); }; //echo $args; $content = @file_get_contents("http://localhost:591/FMPro?" . $args); Good Luck. Garry
September 13, 200520 yr Author Thanks Gary, good idea. What I did do that seems to work is take all the items from the POST and put them into a form so that this form can then be posted to a new page (similar trick to the next and Prev in a long list of items) Francais The javascript eliminates the huge submit button.
September 13, 200520 yr I've just remembered about this one. I used CURL to create a POST from a query string. However, you woud be able to use the "while ($fm_params = Current($_REQUEST))" loop to construct the CURLOPT_POSTFIELDS list, then use this to send it: <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://localhost:591/FMPro"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "-db=combotest.fp5&-format=-fmp_xml&-findall"); curl_exec($ch); curl_close($ch); ?> All the best. Garry
Create an account or sign in to comment