views:

33

answers:

2

Hi

I'm trying to retrieve a url sent in the query strings in a codeigniter function:

    function recipe($url = ''){

        $url = $this->uri->uri_string();
        $url = ltrim($url, '/bookmarklet/recipe/');

        log_message('info', 'URL: ' . rawurldecode($url));

However for some reason the url is always missing a '/' in the http protocol, what i get from the log is something like this:

INFO  - 2010-07-02 12:12:51 --> URL: http:/www.google.com.eg/
A: 

I can't see how you would even get the domain-name. And why is it that you have a $url-argument but overrides it with the first line of code?

I would expect the following output if you went to http://domain.com/bookmarklet/recipe/food
INFO (date etc) --> URL: food

Josso
i don't get the domain name or host, when i call uri_string() it returns: /bookmarklet/start/http%3A%3F%3Fwww.google.com which is what the docs says http://codeigniter.com/user_guide/libraries/uri.html
Yehia A.Salam
A: 

apparently the uri->uri_string() escapes several characters internally, so "http://www." would return 'http:/www.', use server variables instead $_SERVER

Yehia A.Salam