Comments (11)
Hi rajjagani,
Could you please post the error message you are receiving from Twitter? I just tried to post and it works fine for me.
Did you grant your application Read/Write access in admin interface (https://dev.twitter.com/apps/) ?
from codeigniter-twitteroauth.
Yes, i have grant read/write access to my application. the application connect successfully with twitter and return to my website but when i try to store access token than access token include twitter user id along with that as i mention above..so i think this is invalid oauth token..
Now when i am separate the code of access token and used to post a tweet at that time tweet is not post to user account and i am not getting any error in response..
here is my code for post tweet
$this->connection = $this->twitteroauth->create($this->config->item('twitter_consumer_token'), $this->config->item('twitter_consumer_secret'),'Ue1ETxWf6ZFazHZHAioCXKU0DZXcvW1TNWvjeGP', $tweet_data->oauthTokenSecret);
$message=$tweet_data->offerTitle.' @'.$tweet_data->screenName.' - '.site_url('client/claim/index/'.$tweet_data->promId.'/'.$tweet_data->brandId.'/'.$tweet_data->offerId.'/tw');
$data=array(
'status' => $message
);
$content = $this->connection->get('account/verify_credentials');
if(isset($content->error))
{
echo $content->error;
return false;
}
$result=$this->connection->post('statuses/update', $data);
if(!isset($result->error))
{
echo '
Your message is tweet on your twitter account.
';echo 'Back to Main Page';
}
else
{
echo $result->error;
// Error, message hasn't been published
//redirect(base_url('/'));
}
from codeigniter-twitteroauth.
Well, from what I see here, you should use full access_token 1095019810-Ue1ETxWf6ZFazHZHAioCXKU0DZXccccTNWvjeGP
, not only the second part of it.
Also, I hope you are propagating correct access_token_secret with $tweet_data->oauthTokenSecret
, as I don't know what this variable contains.
If this does not help, please post here the error message you are receiving from Twitter.
from codeigniter-twitteroauth.
Ok, as you said i tried with full access token but still i can't tweet to user account and
$tweet_data->oauthTokenSecret contains the OAuth secret token of user.
the problem is i am not getting any error from twitter while posting but still i can't see my tweet on user account.
here is the code what i write for tweet
$this->connection = $this->twitteroauth->create($this->config->item('twitter_consumer_token'), $this->config->item('twitter_consumer_secret'),$tweet_data->oauthToken, $tweet_data->oauthTokenSecret);
$message=$tweet_data->offerTitle.' @'.$tweet_data->screenName.' - '.site_url('client/claim/index/'.$tweet_data->promId.'/'.$tweet_data->brandId.'/'.$tweet_data->offerId.'/tw');
$data=array(
'status' => $message
);
$result=$this->connection->post('statuses/update', $data);
if(!isset($result->error))
{
echo 'Your message is tweet on your twitter account.';
}
else
{
echo $result->error;
}
from codeigniter-twitteroauth.
hey i have tried this library(Only for posting tweet) and its works...
this is link
https://github.com/elliothaughin/codeigniter-twitter
what i found they are using a method
set_tokens($tokens) and after that the code is same while i am trying your code i think it is not set the access token properly so it is not posting tweet..
please take a look this library and tell me i am right or not because i am not sure about this. I am trying to solve this and one more thing the connection of app is not working on this library.
Please reply me as soon as possible
from codeigniter-twitteroauth.
This library you mentioned was updated last time 2 years ago and most probably will not work with present Twitter API.
Unfortunatelly, I cannot reproduce your problem on my installation - my sample controller works fine for auth/posting tweets. Thus, I only can guess what problem you are facing in your code while trying to post a message.
I can recommend you to try sample controller from the repository and if it works - debug your code and find the reason it is not working. Let me know if the sample code not working for you also.
from codeigniter-twitteroauth.
hey can you please post your sample code here of controller so i can compare with that and figure out or you can mail me the code on [email protected].
It would be very helpful.
Thank you
from codeigniter-twitteroauth.
Sample code is in the repository:
https://github.com/MunGell/Codeigniter-TwitterOAuth/blob/master/application/controllers/twitter.php
from codeigniter-twitteroauth.
hey i have try the code as you have mention in above link but still i can't see my tweet on user account and the most difficult part is when i try to debug the code i am not getting any error in twitter response.
but when i try to call LastAPICall() method of your library i get this error
A PHP Error was encountered
Severity: Notice
Message: Undefined property: TwitterOAuth::$last_api_call
Filename: libraries/Twitteroauth.php
Line Number: 56
from codeigniter-twitteroauth.
hey i fix my problem just one change for catch error in your library
in your library you use
"$result->error" for catching errors but you have to used
"$result->errors" and for printing errors
"echo $result->errors[0]->message"
so, the whole code is...
if(isset($result->errors))
{
echo $result->errors[0]->message;
return false;
}
and Thank you for all your help..
from codeigniter-twitteroauth.
Thank you for sharing this! I will update the sample controller accordingly.
from codeigniter-twitteroauth.
Related Issues (17)
- Problem in getting friends/list || followers/list HOT 3
- Twitter auth in codeigniter HOT 2
- authentication not working HOT 2
- News feed? HOT 2
- Image upload not working.
- Undefined index: oauth_token HOT 1
- Twitter auth in codeigniter
- View page link
- Return user data
- Call to undefined function curl_init() HOT 1
- Doesn't seem to authenticate for twitter's 1.1 api HOT 6
- how to get permanent access oauth_token and oauth_token_secret
- Callback goes to the homepage HOT 2
- Failed to load resource: the server responded with a status of 404 (Not Found) HOT 2
- Application-only ???
- Detailed Example HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codeigniter-twitteroauth.