Question

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/
Was it helpful?

Solution 2

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

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top