Hi,

I want to pass query string parameter to drupal modules from web browser directly.

i.e i want to access http://localhost/drupal/?q=admin/build/services/browse/user.get?uid=1 but it shows me message as "Page not found.The requested page could not be found.".

How can i pass the query string parameter to drupal module??

Thanks,
Ravi.

Comments

vasi1186’s picture

Hi,

It's a bit unclear for me what you want to do, but I can tell you a fact: the url is not a valid one. You cannot have two "?" in a url. So, a valid one should be like this: http://localhost/drupal/?q=admin/build/services/browse/user.get&uid=1.
In your callback function that is responsible for this request, you can get the "uid" value from the url via $_GET.
Can you paste here the code snippet where you construct the url?, and maybe I can help you....

Vasi.

ravi_drupal’s picture

Hi Vasi,

Thanks for your quick reply.Sorry for unclear post as i am System programmer and new to web development.

I am trying to get response for the http://localhost/drupal/?q=admin/build/services/browse/user.get&uid=1 . Right now trying by pasting the URL directly into browser.

My final goal is to call services from iPhone and i want to get response generated on iPhone side.

Please let me know if you have any ideas on this.

Thanks,
Ravi.

Jaypan’s picture

You will want to use hook_menu() to register a URL at admin/build/services/browse/user.get/%

The % is a wildcard. You can pass it any value you want, then use the 'page arguments' element of the array you use to register your URL to pass the value to the page callback function.

ravi_drupal’s picture

Hello Jay,
Thanks for your replay.

I will definitely try with this.

Ravi.

pankaj01’s picture

did the suggestion work?

my url is: localhost/myauto/?q=sometext

But the following code does not work!!

mymodule_menu(){
$items['myauto/%'] = array(
'title'= 'My example',
'page callback' => 'myexample_auto',
'page argument' => array('1'),
'access callback' => TRUE,
);

myexample_auto($arg){
...//user $_GET['q'] or drupal_get_query_parameters to get 'sometext' from $arg
}

Jaypan’s picture

...//user $_GET['q'] or drupal_get_query_parameters to get 'sometext' from $arg

You should have this:

mymodule_menu(){
$items['myauto'] = array(
'title'= 'My example',
'page callback' => 'myexample_auto',
'access callback' => TRUE,
);

myexample_auto(){
  //drupal_get_query_parameters to get 'sometext' 
}

Also note that you should not be using q=, as 'q' is what Drupal uses by default (in the background) and you'll mess things up.

Nikdhil Mdohfan’s picture

Try

$_REQUEST['destination'] = ' http://localhost/drupal?q=admin/build/services/browse/user.get?uid=1';

Say thanks.