Take the 2-minute tour ×

I have a small app that uses (used) OAuth Echo in conjunction with Tweetbot's custom image endpoint to self-host media I post to Twitter. The recent API update has broken the app and I can't seem to find any information on how to fix it.

Here is the class I was using prior to the update:

// Twitter oAuth Echo Class
// Author: http://shikii.net/blog/creating-a-custom-image-service-for-twitter-for-iphone/
class namespace_TwitterOAuthEcho
  public $verificationUrl = "https://api.twitter.com/1/account/verify_credentials.json";

  public $userAgent = __CLASS__;

  public $verificationCredentials;

   * @var int
  public $resultHttpCode;
   * @var array
  public $resultHttpInfo;
  public $responseText;

   * Save the OAuth credentials sent by the Consumer (e.g. Twitter for iPhone, Twitterrific)
  public function setCredentialsFromRequestHeaders()
    $this->verificationCredentials = isset($_SERVER['HTTP_X_VERIFY_CREDENTIALS_AUTHORIZATION'])

   * Verify the given OAuth credentials with Twitter
   * @return boolean
  public function verify()
    $curl = curl_init($this->verificationUrl);
    curl_setopt($curl, CURLOPT_USERAGENT, $this->userAgent);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
        'Authorization: ' . $this->verificationCredentials,

    $this->responseText = curl_exec($curl);
    $this->resultHttpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    $this->resultHttpInfo = curl_getinfo($curl);

    return $this->resultHttpCode == 200;

As a twitter API novice, I'm not certain what to change to get it working again. Twitter's OAuth Echo documentation hasn't been updated since Aug. 2012, so that's of no help.

Twitter's API 1.1 Overview page does say that all endpoints now require authorization. Fine. I set up a new app; got my Consumer key/secret. I'm not certain where those go, however. When editing the application settings on Twitter, I'm also not certain what settings should be in place here. My app doesn't (in my opinion) actually need to interact with Twitter. I'm just trying to send a URL back to Tweetbot (any twitter client) so it can place it in the tweet.

Any help in getting this updated would be much appreciated. Thank you.

share|improve this question

1 Answer 1

up vote 5 down vote accepted




public $verificationUrl = "https://api.twitter.com/1.1/account/verify_credentials.json";

Thats it. You just need to change the URL only. There is no need to change in your twitter APP also. It will work with you old APP also.

share|improve this answer
That was embarrassingly simple. Thank you for saving me from testing a wide range of completely unnecessary variations to my code. –  Shelton Mar 15 '13 at 18:21

Your Answer


