0

Using Chargify with Codeigniter framework. On completion of signup with Chargify, the return URL can be set with parameters. It seems that these parameters can only be returned ?id=123&ref=321. With Codeigniter, how do I grab those return paramenters?

http://www.website.com/confirmation?id=3163255&ref=5159c58278a1f
8
  • -1 due to lack of efforts. Commented Apr 1, 2013 at 17:45
  • @itachi uh, lack of effort my ass. I've been working on this for the past hour. If I am missing something stupid why not enlighten me instead of voting down with no input. Commented Apr 1, 2013 at 17:47
  • Are you asking how to extract the parameters from the url? If so, then: $id = $_GET['id']; and $ref = $_GET['ref']; should work. Commented Apr 1, 2013 at 18:19
  • typically that would work. CodeIgniter strips all GET parameters, so without enabling query strings I can't do it this way. Chargify forces this return and I was looking for a solution to handle this. Commented Apr 1, 2013 at 19:46
  • 1
    Dude, exactly what I needed. Can you put into a question so I can hook you up with answer? Thanks @Lefters Commented Apr 1, 2013 at 20:33

1 Answer 1

2

CodeIgniter, by default, destroys the $_GET variable that one would usually use to access the parameters in a URL.

This line will parse the URL and populate the $_GET array with the URL's parameters. It's useful for when you want to selectively use the $_GET array in a CodeIgniter project, rather than having to enable CodeIgniter's query strings, which would be globally and continually active.

parse_str(substr(strrchr($_SERVER['REQUEST_URI'], "?"), 1), $_GET);

It can then be accessed as you would normally access an array, for example:

$id  = $_GET['id'];
$ref = $_GET['ref'];
Sign up to request clarification or add additional context in comments.

1 Comment

Please do not duplicate answers. Instead link the question that has the answer already in form of a comment or a duplicate-close-vote. Especially as you duplicate even your own answers. (As you can see duplicate content like these comments are really not helpful for the site in the long run)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.