Passing URIs as URL arguments in Drupal
- by wynz
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...
http://mysite.com/page/http%3A%2F%2Fdbpedia.org%2Fresource%2FCoffee Completely breaks Drupal's rewriting
http://mysite.com/page/?uri=http%3A%2F%2Fdbpedia.org%2Fresource%2FCoffee Gives a 404
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?