Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Parsing a url

Featured Replies

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

  • 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.

Try this:

$_SERVER["QUERY_STRING"]

Garry

  • 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.

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

  • 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.

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

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.