Passing URIs as URL arguments in Drupal 6

Posted by wynz on Stack Overflow See other posts from Stack Overflow or by wynz
Published on 2010-06-15T11:42:46Z Indexed on 2010/06/16 14:02 UTC
Read the original article Hit count: 170

Filed under:
|

I'm running into problems trying to pass absolute URIs as parameters with clean URLs enabled.

I've got hook_menu() set up like this:


function mymodule_menu() {
  return array(
    'page/%' => array(
      'title' => 'DBpedia Display Test',
      'page callback' => 'mymodule_dbpedia_display',
      'page arguments' => array(1),
    ),
  );
}

and in the page callback:


function mymodule_dbpedia_display($uri) {
  // Make an HTTP request for this URI
  // and then render some things
  return $output;
}

What I'm hoping to do is somehow pass full URIs (e.g. "http://dbpedia.org/resource/Coffee") to my page callback. I've tried a few things and nothing's worked so far...

  1. http://mysite.com/page/http%3A%2F%2Fdbpedia.org%2Fresource%2FCoffee
    Completely breaks Drupal's rewriting
  2. http://mysite.com/page/?uri=http%3A%2F%2Fdbpedia.org%2Fresource%2FCoffee
    Gives a 404
  3. http://mysite.com/page/http://dbpedia.org/resource/Coffee
    Returns just "http:", which makes sense

I could probably use $_GET to pull out the whole query string, but I guess I'm hoping for a more 'Drupal' solution. Any suggestions?

© Stack Overflow or respective owner

Related posts about drupal

Related posts about url-rewriting