Codeigniter 2 and Twitter integration
In Codeigniter(version 2.0): Twitter returns a user to开发者_运维知识库
domain.com/connections/twitter/?oauth_token=UXrtdKuLS2N6TCUJdtQAB&oauth_verifier=UXrtdKuLSUXrtdKuLS2N6TCUJdtQAB2N6T
But I keep getting a 404 page. Am I missing something really simple yet important?
Note: Page becomes visible, if I remove '?' from the url.
You need to enable Query Strings the GET array in CodeIgniter.
In application/config/config.php
:
$config['allow_get_array'] = TRUE;
allow_get_array
will allow you to use $_GET
(or rather $this->input->get()
in your controller). With this enabled, you can disable query strings (if you want):
$config['enable_query_strings'] = FALSE;
Or you can utilize a A3M setup, which has all the openid / facebook / twitter pieces built in and working (less tinkering, and you get a working CodeIgniter install)
Details here:
- https://github.com/donjakobo/A3M
You could $_GET the OAuth token in a file outside of your Codeigniter application and pass it to your controller as a parameter in the URI, like...
outside of your application folder...
<?php header('Location: http://yourdomain.com/twitter' . $_GET['oauth_token']);?>
This will send your token to the twitter controller, in which you can do
$token = $this->uri->segment(3);
and then process it how you need. Are you using any kind of OAuth library such as jmathai's twitter-async ?
精彩评论