I am a newbie to drupal community. So please bear with me if it's really a basic question.

A 3rd party site will be sending paramteres to my drupal module using "get method". These paramters will have a url and some other information. So they will be hitting my module with a url something like http://{domain_name}/mymodule/channel/publisher=yahoo&url=http://www.yahoo.com where 'mymodule/channel' is the path set inside the hook_menu() function. When I get these paramters inside my module they get parsed for every '&' and '/' by drupal system. How can I get intact paramter values as we do in php using _REQUEST.

Any help will be highly appreciated.

Thanks in advance.


amitaibu’s picture

Maybe $url1 = $arg(1)
You can also use the token module to get Arguments from the url [path:arg-x] or something similar.

gizra.com - where cool software developers meet geek fashion designers

luco’s picture


your comment was really helpful. thank you!

but it's actually $url1 = arg(1), because arg is a function, not a variable. ;)



"There is no off position on the genius switch."
- David Letterman

gpk’s picture

I'm assuming that your url intended to include the ?, i.e.

(Note that if your site is not running clean URLs the URL would need to be of the form

In either case you can use $_GET in the usual way, so $_GET['publisher'] and $_GET['url'] will contain the parameter values you are after.

And note that because of Drupal's mod_rewrite trickery, $_GET['q'] (in either case) will be populated with mymodule/channel.

The arg() function may not help you here ... arg() simply explodes $_GET['q'] on /, so that arg(0) = mymodule and arg(1) = channel.


randeepkandhola’s picture

perfect gpk ..it helped..thanks

gpk’s picture

edill3484’s picture

This worked for me. I have clean urls turned on and I couldn't pass more than 1 "get" variable before it would crop off the rest of them. So I used the method ?x=foo/bar/foo2/bar2 and then did split($_GET['x']) to retrieve all of the variables.

Thanks for the reply.

laurentnguyen42’s picture

You should use drupal_get_query_parameters() instead of $_GET;

basstradamus’s picture

What if I have clean urls switched on?

Antinoo’s picture

Randeep HAD clean urls on: what's the problem?

jolava’s picture

For those who want to see the alias path url instead of the Drupal internal url (node/$/nid), here is the function I use:

function url_alias_path() {
return explode('/',$_SERVER['REQUEST_URI']);

It returns an array with all the parameters in the URL.

mossill’s picture

dope. thanks

bobotche’s picture


cyberitch’s picture

If I want Drupal to store a parameter passed to any section of the web site so I can access it in a specific module, how would I do that.

For example:

How can I catch $_GET['para'] and store it in Drupal session or any where else so in my custom module I can read the 'para'?

Thank you

Jaypan’s picture

$parameters = drupal_get_query_parameters();
  $_SESSION['para'] = $parameters['para'];
anbudhan’s picture

Hi I am trying to get data from drupal service api using postman.

can some one tell me how to get set the parameter to download lesserthan a specific date?
I tried https://bcc-prod.codeenigma.net/api/v1/entity_commerce_product?parameter... <=1428930969:

but it is not working. any help will be hugely appreciated