0

i am trying following code to display my user name when logged in to flickr.I tried a lot of things but it just dont show the username.

require 'phpflickr/phpflickr.php';
$api_key = "xxxxxxx";
$secret = "xxxxxxxx";
$perms = "read";
// Clear the token if it is set
if( isset($_SESSION['phpFlickr_auth_token']) )
     unset($_SESSION['phpFlickr_auth_token']);

// Grab the authentication redirect if it is set
if( isset($_SESSION['phpFlickr_auth_redirect']) && 
    !empty($_SESSION['phpFlickr_auth_redirect']) ) {
$redirect = $_SESSION['phpFlickr_auth_redirect'];
unset($_SESSION['phpFlickr_auth_redirect']);
}
$f = new phpFlickr($api_key, $secret, true);
$userData = $f->auth_checkToken($_SESSION['phpFlickr_auth_token']);
if ($f->getErrorMsg() !== false) {
    die("Error: ".$f->getErrorMsg());
}
$userNSID = $userData['user']['nsid'];

echo $userNSID;

i get a frob token in the url when returning from logging in and from there it does nothing.

robert
  • 17
  • 5
  • Where's your code that's meant to actually display the user name? – Matt Gibson Aug 29 '14 at 12:27
  • i forget that but i use echo $userNSID; i edited the code above also – robert Aug 29 '14 at 12:28
  • And what do you see if you do `var_dump($userData);`? – Matt Gibson Aug 29 '14 at 12:37
  • well that is the strange part even if i do echo $userNSID, "111111" it displays nothing, with var_dump also nothing. – robert Aug 29 '14 at 12:45
  • So, perhaps you have error display turned off, and your script is dying before it gets to the echoing? What happens if you turn on error reporting, as described in [this answer](http://stackoverflow.com/a/5438125/300836), at the top of your script? – Matt Gibson Aug 29 '14 at 12:48
  • i have this on – robert Aug 29 '14 at 12:51
  • So you're not seeing any output? I take it you've tried simple sanity checks like `echo 'Hello!';` at the top of the script, yeah? – Matt Gibson Aug 29 '14 at 14:29
  • sorry i was out, yes i did that to i also tried older approaches too, but same problem.i also tried a whole sample from this year and that is also giving me no nsid.and i need that nsid of the logged in user to use it for other things. i use the example from here https://gist.github.com/1306604 – robert Aug 29 '14 at 15:28

0 Answers0