Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6033075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:25:50+00:00 2026-05-23T05:25:50+00:00

i have been doing some integration with twitter using php and this api: https://github.com/abraham/twitteroauth

  • 0

i have been doing some integration with twitter using php and this api: https://github.com/abraham/twitteroauth

I’ve managed to tweet, but im having some difficulties in understand and evaluate the return values.

For instance in the file callback.php if i want to post a tweeter i have this code:

$result = $connection->post(  
'statuses/update',  
array(  
    'status' => 'Tweet teste de API!',  
));

but how do i know what $result is returning me? i’ve tried to echo it and for it but it doesnt seem to work, any insights on that? I want to be able to see all the returning keys available.

I’ve tried this:
foreach ($result as $key => $value) {
echo "$key, $value <br />";
}

but it only prints two keys then a error appers that i cant convert stdclass. Any insight on how to see this or better api documentation?

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:25:51+00:00Added an answer on May 23, 2026 at 5:25 am

    When posting with statuses/update, the returned $result will be a PHP class/object containing the created tweet, structured the same as status/show:id.

    It looks like http://dev.twitter.com/doc/post/statuses/update fails to mention that the created tweet will be returned upon success. But if you read the bottom of http://dev.twitter.com/doc/get/statuses/show/:id, you can see all the different data you can access from $result.

    You should also be able to see the object’s entirety with var_dump($result).

    This example should hopefully work for you; it posts the tweet, then echos the created tweet’s text and the user’s screen name:

    $result = $connection->post(
        'statuses/update',
        array('status' => 'Tweet teste de API!') // no comma needed here, by the way
    );
    if ($result->id) {
        // Tweet posted successfully, and $result contains the tweet data
        echo $result->text . '<br />Tweeted by @' . $result->user->screen_name;
    } else {
        // Tweet failed
        echo 'Status failed to be updated.';
    }
    

    Similarly, pretty much any Twitter resource found on http://dev.twitter.com/doc can be accessed with $result = $connection->post().

    Just have the 1st parameter be a string of the desired resource (eg statuses/update or users/show), and the 2nd parameter be an array of the resource’s parameters, then you can access whatever the resource returns with $result.

    The Twitter API is at your fingertips, and abraham’s twitteroauth library makes it easy 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been doing some research about this and have found a few similar
I have been doing some java development lately and have started using Eclipse. For
We have been doing some research into physically isolating the secure and non-secure sections
I have been doing some research on test driven development and find it pretty
I've been doing some Web-Projects lately that rely on heavy Data-Binding and have been
I would like to compare two dates in javascript. I have been doing some
Right, bit of a strange question; I have been doing some linq to XML
I have been looking in to doing some test driven development for one of
I have been doing TDD and was using it more as unit testing than
I have been doing PHP stuff for almost one year and I have never

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.