CodeIgniter Forums
Having Trouble Using A URL As A Parameter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Having Trouble Using A URL As A Parameter (/showthread.php?tid=28739)



Having Trouble Using A URL As A Parameter - El Forum - 03-19-2010

[eluser]helloworldly[/eluser]
Is it possible to use the URI segment method when you are trying to want a parameter to be a url? Or does the path need to use query strings? Or something I'm missing? What do folks recommend?

Would be nice to have something like this:

http://example.com/some_class_name/some_function_name/http://somesite.com/something!23.xml

But I get an Apache 404 error, which, by the way, seems to prematurely decodes the url parameter:

"The requested URL /some_class_name/some_function_name/http://somesite.com/something/2123.xml was not found on this server."

Thanks for any help!


Having Trouble Using A URL As A Parameter - El Forum - 03-19-2010

[eluser]Twisted1919[/eluser]
You can allow ( and ) in the url like allowed chars , then pass your url like :
blah.com/controller/method/(http://myfancysite/with/a/link/to/a/xml.file)
Didn't tried but must work as long as you don't have other chars in the uri .


Having Trouble Using A URL As A Parameter - El Forum - 03-19-2010

[eluser]bretticus[/eluser]
Man, loading anonymous content via browser URI seems a little scary to me. Hope you have a good filtering mechanism in place!


Having Trouble Using A URL As A Parameter - El Forum - 03-19-2010

[eluser]helloworldly[/eluser]
Thanks folks.

@Twisted1919 :

An Error Was Encountered
The URI you submitted has disallowed characters.

Url was a twitter rss feed: so:
(http://twitter.com/statuses/user_timeline/123456789.rss)

@bretticus:
The url is an optional way to pass a feed url to be processed by SimplePie parser. Should I reconsider?

Thanks again!


Having Trouble Using A URL As A Parameter - El Forum - 03-19-2010

[eluser]helloworldly[/eluser]
Ah, @Twisted1919 "You can allow ( and ) in the url like allowed chars"...

Didn't know about $config['permitted_uri_chars']. Works. Thanks much @Twisted1919.

Now, re: @bretticus, is the question of whether I should even be doing this!


Having Trouble Using A URL As A Parameter - El Forum - 03-19-2010

[eluser]bretticus[/eluser]
I suppose that depends on how much you trust SimplePie. It's just that you are effectively allowing anyone to have your PHP code load any document of their choosing. I have no idea how SimplePie loads/parses a remote document. If it's an option, they may just have it locked down tight. However, unless you need to let you users pop in any feed of their choosing, you could always just provide a list of urls (or websites) that you trust. IF the URL is not part of that domain, reject it. On the other hand, I think I remember seeing SimplePie demo with a write in text field to do exactly what you are doing.