Welcome Guest, Not a member yet? Register   Sign In
Support for $_GET
#1

[eluser]david_ais[/eluser]
Can someone please clarify the position regarding support for $_GET within CI.

I recall somewhere seeing a statement from Rick Ellis that CI doesn't support it and that any GET values passed to CI are simply destroyed. The reason for seeking clarification is that I've just seen the CI changelog for 1.5.4 and discovered some way down the page is an entry suggesting that $_GET had been supported at some point in the past.

I have a particular requirement for this at present because I'm developing an application that links to an external credit card processing services provider whose callback function only provides a response via GET. So I have to find a solution.

Having unsuccessfully tried all the CI options I could find, the only other option I had was to switch to using Kohana. I don't want to open up a discussion here about the merits or otherwise of Kohana other than to say my strong preference is to stick with CI - provided that it has the tools I need to do the job.

I did come across a forum post from someone who had hacked the Input class to add support for GET. But a hack - however good it is and I'm not suggesting that it's not a fine piece of coding - suffers from the fundamental problem that it's not part of the official CI release. So there would always be a support issues and uncertainty every time a there's a new release of CI.

For myself, the lack of support of GET is a major roadblock to using CI. If it's not supported - or at least planned within a reasonable time frame then I think my only option would be to look for a completely different framework. I don't want to do that if at all possible - I really like CI.

So the key question - I guess directed at Rick - will you add support for $_GET



Regards

David Bell
#2

[eluser]Derek Jones[/eluser]
David, you can find CI's available use of $_GET here. In a nutshell, GET is available if you have query strings enabled. It's under consideration, but there are no plans at the present time to change this behavior. You can, however, find a variety of workarounds here in the forums and wiki that users have implemented to allow GET on their installations, and you're certainly free to modify the framework to behave however you like!
#3

[eluser]edwardj[/eluser]
Whenever I need to get any type of data from the URL (eg email validation strings or even a message id as you see in every url of the forum) I just use routes?

Do you have no control of the callback url that will be passed back?
#4

[eluser]david_ais[/eluser]
No - I've got no control whatsoever over the external site. I'm stuck with trying to access values stored in $_GET. Just to make things harder they don't even properly document the callback parameters.
#5

[eluser]david_ais[/eluser]
[quote author="Derek Jones" date="1184360891"]In a nutshell, GET is available if you have query strings enabled.[/quote]

Yes I looked at that. But if query strings are enabled then according to the documentation the URL helper and other unspecified helpers or parts thereof don't work any more. That sounds like solving one problem and creating another - albeit more solvable one.

[quote author="Derek Jones" date="1184360891"]You can, however, find a variety of workarounds here in the forums and wiki that users have implemented to allow GET on their installations, and you're certainly free to modify the framework to behave however you like![/quote]

The problem with the workarounds is they all seem to involve some sort of hack of the CI codebase. And that creates a significant and unacceptable ongoing support issue for the application I'm developing. Every update to CI would require the hack to be re-evaluated to see if it still functions correctly and that there are no security issues. To be honest - even if I had the time - my PHP skills aren't up to the task of guaranteeing the security of a modified version of CI.


Regards

David Bell
#6

[eluser]Derek Jones[/eluser]
Well, this may not be ideal, but another workable solution might be a small standalone script whose sole purpose is to receive and convert the GET data into a request that CI will handle in a more friendly out-of-the-box manner.
#7

[eluser]david_ais[/eluser]
[quote author="Derek Jones" date="1184376954"]Well, this may not be ideal, but another workable solution might be a small standalone script whose sole purpose is to receive and convert the GET data into a request that CI will handle in a more friendly out-of-the-box manner.[/quote]

Perhaps. What I would need such a script to do would be to validate the incoming data, assemble it into an array and pass the resulting array into CI for further processing.

It's beginning to sound like I'm having to re-invent the wheel here! And then there's the question of how I pass the array to CI.

I really don't understand the reluctance to support $_GET properly. The problem I'm facing is a genuine real-world situation - the sort of thing that a framework should handle effortlessly. So why are you making programmers jump through hoops over this?


Regards

David
#8

[eluser]Derek Jones[/eluser]
I wouldn't say that it's hoops; CI just requires you to make a choice: use segments or query strings. The design of application is largely based around the clean URLs of the segment approach, hence that's how the Helper's were designed. Building your own URLs isn't too difficult of a task. It's noteworthy that the workarounds that some use do not require you to run query strings, and therefore, you can use the Helpers and other URL building functions with impunity. Are you sure you've looked closely at them to see that they will not work for you?
#9

[eluser]david_ais[/eluser]
I spent a couple of days trying to find a solution. Having completed most of the application apart from the one method to handle this one callback operation - it's not entirely straightforward to switch to using query strings at this stage. Maybe I have missed something somewhere. But having spent that amount of time - when I came across Kohana it seemed like the only workable solution.

Would you be able to respond to my query about the reluctance to support $_GET in CI?


Regards

David
#10

[eluser]Derek Jones[/eluser]
Quote:Would you be able to respond to my query about the reluctance to support $_GET in CI?

It can be fairly polarizing in the forums here, and there are plenty of existing topics to read through, so I'm going to decline to say anything other than it's the way the framework is designed. CI wants you to use URL segments and have clean, query string free URLs. I understand if that's not an answer that satisfies you, but I do encourage you to read through the many existing topics on the subject--the workarounds are not very severe nor hard to keep up with across updates. If it's a feature that's very important to you and you want to use CI to build your application, you would either need to modify CI (which is one of the great things about open source frameworks) or be willing to work around it with an external solution.




Theme © iAndrew 2016 - Forum software by © MyBB