Sending variables via URI string |
[eluser]evolutionxbox[/eluser]
Hello all! I would like to send a controller a url variable via the uri string. I don't know how to do it because the forward slashed ruin the variable. The anchor href: "http://example.com/test/play/http://somesite.com/music.mp3" This doesn't work, can anyone help? ... Controller: Code: <?php View is blank (using controller to echo).
[eluser]Bart v B[/eluser]
maybe i am wrong or don't understand youre question, but you can try the uri and the base_url() helper. Code: echo base_url().$this->uri->segment(3); Or is it from an external site??
[eluser]danmontgomery[/eluser]
You can't stick a URL in another URL, you have to encode it. http://php.net/manual/en/function.urlencode.php
[eluser]evolutionxbox[/eluser]
[quote author="noctrum" date="1271462617"]You can't stick a URL in another URL, you have to encode it. http://php.net/manual/en/function.urlencode.php[/quote] I thought so... but now it is flat out telling me the page doesn't exist. An example url: http://example.com/test/play/http://feed...1apr10.mp3 (Actual url of a real mp3 file encoded).
[eluser]evolutionxbox[/eluser]
Example url was meant to be this: Code: http://example.com/test/play/http%3\A%\2F%\2Ffeedproxy.google.com%\2F%\7Er%2\Fcccpodcast%2\F%\7E5%\2F0BI0tSuWaJM%\2F11apr10.mp3 This forum keeps un-encoding the url... argh (remove the backslashes for the true url)!
[eluser]Matthieu Fauveau[/eluser]
Try editing the config/routes.php and add something like : Code: $route['test/play/:any'] = 'test/play'; That should help
[eluser]evolutionxbox[/eluser]
[quote author="Matthieu Fauveau" date="1271482346"]Try editing the config/routes.php and add something like : Code: $route['test/play/:any'] = 'test/play'; That should help [/quote] I added: Code: $route['test/play/:any'] = 'test/play'; To the routes.php config file but nothing has happened, it comes up with: Code: Object not found!
[eluser]Matthieu Fauveau[/eluser]
For your Apache error, see this : http://stackoverflow.com/questions/31180...gniter-app Beside, I've just looked at your controller code again and what you've written would not output the URL anyway. You need something more like : Code: function play() { Hope this is helping !
[eluser]evolutionxbox[/eluser]
Thank you, you are helping... I will update this thread after making the changes tomorrow. |
Welcome Guest, Not a member yet? Register Sign In |