0

I am trying to make this work but, I need help on this function. It works great but after I modifed it to show user dashboard with choreos from Temboo i get no results. The two functions are in different php files namely index.php and dashboard.php . Please show me where I could be having errors. Thank you

Main source :https://raw.github.com/matthewflaming/temboo-experiments/master/TumblrOauth/tumblrOauth.php

My dashboard.php : https://tumblr-app-c9-c9-paulkinobunga.c9.io/dashboard.php

Too see my index.php file replace dahboard.php with index.php

The Function

function getUserInfo($session) {

global $AccessToken, $AccessTokenSecret;

// Instantiate the Choreo, using a previously instantiated Temboo_Session object, eg:
$getUserInformation = new Tumblr_User_GetUserInformation($session);

// Get an input object for the Choreo
$getUserInformationInputs = $getUserInformation->newInputs();

// Set inputs
 $getUserInformationInputs->setAPIKey(TUMBLR_CONSUMER_KEY)->setAccessToken($AccessToken)->setAccessTokenSecret($AccessTokenSecret)->setSecretKey(TUMBLR_CONSUMER_SECRET);

// Execute Choreo and get results
$getUserInformationResults =      $getUserInformation->execute($getUserInformationInputs)->getResults();

return $getUserInformationResults;
}

To get response I simply say:

Raw response returned by Tumblr:

<?php

// Get current user info for Tumblr
$currentUserResults = getUserInfo($session);

print_r($currentUserResults);
?>

THE MODIFIED FUNCTION

function getUserDash($session) {

global $AccessToken, $AccessTokenSecret;

// Instantiate the Choreo, using a previously instantiated Temboo_Session object, eg:
$getUserDashboard = new Tumblr_User_GetUserDashboard($session);

// Get an input object for the Choreo
$getUserDashboardInputs = $getUserDashboard->newInputs();

// Set inputs
   $getUserDashboardInputs->setAPIKey(TUMBLR_CONSUMER_KEY)->setAccessToken($AccessToken)->setAccessTokenSecret($AccessTokenSecret)->setSecretKey(TUMBLR_CONSUMER_SECRET);

// Execute Choreo and get results
$getUserDashboardResults = $getUserDashboard->execute($getUserDashboardInputs)->getResults();

return $getUserDashboardResults;
}

To get response I say

 //Raw response returned by Tumblr:<br>
<?php

            // Get current user info for Tumblr
            $currentUserResults = getUserDash($session);

            print_r($currentUserResults);
        ?>

The two functions are in different php files namely index.php and dashboard.php . Please show me where I could be having errors.

paulobunga
  • 277
  • 6
  • 13
  • Have you looked through your error logs? If not, I would look through those to see any errors that are coming up. Debugging blindly, and without much information other than code is rough work. Better to find an anchor to get you going in the right direction. http://www.phpfreaks.com/tutorial/debugging-a-beginners-guide is a great resource to get you started debugging properly. – Jim Sep 20 '13 at 14:51
  • Use `diff` to find any code-level differences. Since you've provided absolutely NO details on **HOW** these two code chunks are working differently, we can't help you any farther than that. – Marc B Sep 20 '13 at 14:51
  • the function is an extract from https://raw.github.com/matthewflaming/temboo-experiments/master/TumblrOauth/tumblrOauth.php and after entering my Authentication details it worked and I got a JSON response but after modifying the function i just could nt get it to work it was instead returning a blank page – paulobunga Sep 20 '13 at 15:29
  • The support team at temboo gave me help, those guys are great... – paulobunga Sep 20 '13 at 16:26
  • If you received help and solved it, why not add the answer here...as an answer so that way anyone who is having a similar issue can have a reference with how to fix it? @PaulKin – Jim Sep 20 '13 at 22:20

1 Answers1

1

The problem here is that the Temboo Choreography is incorrectly referenced in the sample "getUserDash" function you've provided.

Rather than "Tumblr_User_GetUserDashboard" the name of the object should be "Tumblr_User_RetrieveUserDashboard" -- so the code should look like:

function getUserDash($session) {

   global $AccessToken, $AccessTokenSecret;

   $getUserDashboard = new Tumblr_User_RetrieveUserDashboard($session);

   $getUserDashboardInputs = $getUserDashboard->newInputs();

   $getUserDashboardInputs->setAPIKey(TUMBLR_CONSUMER_KEY)->setAccessToken($AccessToken)->setAccessTokenSecret($AccessTokenSecret)->setSecretKey(TUMBLR_CONSUMER_SECRET);

   // Execute Choreo and get results 
   $getUserDashboardResults = $getUserDashboard->execute($getUserDashboardInputs)->getResults();

   return $getUserDashboardResults; 
}
mflaming
  • 1,167
  • 7
  • 8