Hi,

I'm working with a non-profit membership group that tweets when a new
person joins or a member renews.  The functionailty is part of our php
programming that updates the database, etc. when the membership is
processed.  It was working prior to the change requiring OAuth for
validation.

I've made a simple test file to try to get everything working before
integrating into our system. It is not working and I can't tell
why ... it APPEARS that the connection is there and the result is good
("try" works).

I've made no changes to the twitteroauth files, and they are being
successfully called.  The function (getConnectionWithAccessToken) is
pasted directly from the API documentation/support pages.

Code is as follows (echos were for my testing purposes and will be
removed in final version and I've removed my keys).

<?php
     $tweetmessage = "Welcome new HSMG member xxx";
     try {
           require_once("twitteroauth/OAuth.php");
           require_once("twitteroauth/twitteroauth.php");
           function getConnectionWithAccessToken($oauth_token,
$oauth_token_secret)
                {
                    $connection = new TwitterOAuth(CONSUMER_KEY,
CONSUMER_SECRET, $oauth_token, $oauth_token_secret);
                    return $connection;
                }

               $connection = getConnectionWithAccessToken("xxx",
"xxx");
               if ($connection)
               {
                   echo "<p>Have connection</p>";
               }
               $connection->post('statuses/update', array('status' =>
$tweetmessage));
                $tweetresult = "Good";
            }
            catch(Exception $e)
            {
                $tweetresult = "Bad";
            }
echo "$tweetresult";
?>

This is probably some simple error on my part, but I am not familar
enough with the classes, calls and OAuth requirements to easily debug.

Any assistance would be appreciated.

Marie

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to