Welcome Guest, Not a member yet? Register   Sign In
Problems with query string parameters
#1

[eluser]joanfihu[/eluser]
I need to get the query string parameters from a url that twitter sends to me:

http://localhost:8888/marnews/index.php/...XXXXXXXXXX

When I recive this request I get a 302 error and I'm redirected to: http://localhost:8888/marnews/index.php/...cess_token (Notice that is the same url without query string parameters)

Do you know any way to get this parameters without enabling query strings?

I'm using Codeigniter Reactor 2.0.2

I've tried to do
Code:
echo $this->input->get('oauth_token');
and
Code:
print_r($_SERVER)
but I think that when I'm redirected and I loose this data.

Do you know how to fix this?

Thanks in advance.
#2

[eluser]regal2157[/eluser]
You should use post methods, if this is a form. If not, just make your URL something like
http://localhost:8888/marnews/index.php/...XXXXXXXXXX

And then you can use the uri helper, and grab the segment(n) respective to each one.

E.G.
Code:
<?php
...
$token = $this->uri->segment(3);
$veri = $this->uri->segment(4);

If you want to use the GET method, you have to do some editing in other files to make it work. I would just stay away from it.
#3

[eluser]bretticus[/eluser]
Of course that is if you actually have the choice of specifying your URI with twitter. I still hate that CI squashes this. There are some work arounds. If you can do what @regal2157 suggests, go for it! If you can't, lemme know.
#4

[eluser]regal2157[/eluser]
Ha. Totally didn't even think about that. But for Twitter... http://codeigniter.com/wiki/OAuth_for_Twitter/
#5

[eluser]joanfihu[/eluser]
Hi,

I'm already using this library. I've fixed the problem. Seems that if you want to use query strings in CI 2.0.2 you have to change this lines in config.php:

Code:
$config['uri_protocol'] = 'QUERY_STRING';
$config['enable_query_strings'] = TRUE;

If you don't change it and use query strings you will be redirected (Error 302).

Thanks for all Smile




Theme © iAndrew 2016 - Forum software by © MyBB