2

Posting image + status with the Twitter API using php

I was following this answer but everywhere I find that you need consumerKey, consumerSecret, accessToken and accessTokenSecret to post from backend and I created a new project in apps.twitter.com but there is no accessToken and accessTokenSecret. There is just consumerKey and consumerSecret.

Then I found this Answer How to get user Access Token and Access Secret with the Twitter API using php but there is a problem It redirect to twitter to user twitter account to authenticate but I don't need user authentication because I don't want to do anything from user account.

Instead what I actually wanna do is, I want just one account, my account accessToken and accessTokenSecret (which is currently not available on apps.twitter.com) so that anyone post any new article in my website it will post on twitter directly from backend with heading, link and image from my account (basically business account) without user knowing.

1 Answers1

1

Let me see if I've understood you.

  1. Your website has a Twitter account (@webiste).
  2. You have a Twitter App with consumerKey/consumerToken.
  3. A user visits your website.
  4. The user posts a new article.
  5. @website then Tweets the article from its own account.

This is quite simple.

Visit your app's settings page - the URL will look like https://apps.twitter.com/app/123456/keys

You will see your consumer key and secret.

Scroll down to "Your Access Token" enter image description here

Click the "Create my access token" button and you will get an Access Token and Access Token Secret.

Terence Eden
  • 14,034
  • 3
  • 48
  • 89