I am trying to embed vimeo video playlist script in module but I have problem with getting $token param.

This is file where I get the vimeo key, secret and token using official php library: https://github.com/vimeo/vimeo.php


define( '_JEXEC', 1 );
define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../../../..' ));
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

$mainframe =& JFactory::getApplication('site');
$user =& JFactory::getUser();
$session =& JFactory::getSession();

jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule('mod_module');
$moduleParams = new JRegistry();
    $vkey = $moduleParams->get('vimkey'); 
    $vsecret = $moduleParams->get('vimsecret'); 
    $vtoken = $moduleParams->get('vimtoken'); 

    $key = '$vkey'; 
    $secret = '$vsecret';
    $token = '$vtoken';

The script correctly get $vkey and $vsecret params but not the $vtoken. I get this error on console:

You must provide a valid authenticated access token.

and I get this for the var_dump of the $vtoken

string(32) "3wsrsdf234mytoken2342werwr"

But when I change param $token to:

$token = '3wsrsdf234mytoken2342werwr';

Then script work properly. How can I fix this issue?



if(!isset($_REQUEST['type']) || !isset($_REQUEST['page']) || !isset($_REQUEST['per_page']) || IsNullOrEmpty($key) || IsNullOrEmpty($secret) || IsNullOrEmpty($token)) exit("PHP Vimeo information missing!");

function IsNullOrEmpty($v){
    return (!isset($v) || trim($v)==='');

$type = $_REQUEST['type'];
$page = $_REQUEST['page'];
$per_page = $_REQUEST['per_page'];
$path = isset($_REQUEST['path']) && !IsNullOrEmpty($_REQUEST['path']) ? $_REQUEST['path'] : null;
$user = isset($_REQUEST['user']) && !IsNullOrEmpty($_REQUEST['user']) ? $_REQUEST['user'] : null;
$query = isset($_REQUEST['query']) && !IsNullOrEmpty($_REQUEST['query']) ? $_REQUEST['query'] : null;
$sort = isset($_REQUEST['sort']) && !IsNullOrEmpty($_REQUEST['sort']) ? $_REQUEST['sort'] : 'date';

use Vimeo\Vimeo;
$vimeo = new Vimeo($key, $secret, $token);

if($type == 'vimeo.channel'){

    //Get a list of videos in a Channel - https://developer.vimeo.com/api/playground/channels/{channel_id}/videos
    $result = $vimeo->request("/channels/$path/videos", array(
                                                    'page'=> $page,
                                                    'per_page' => $per_page,
                                                    'fields' => 'uri,name,description,duration,width,height,privacy,pictures.sizes',
                                                    'sort' => $sort,
                                                    'direction' => 'asc',                                   
                                                    'query' => $query));


echo json_encode($result);

2 Answers 2


Try this:

define( '_JEXEC', 1 );

define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../../../..' ));
require_once ( JPATH_BASE .'/includes/defines.php' );
require_once ( JPATH_BASE .'/includes/framework.php' );

$mainframe = JFactory::getApplication('site');

$session = JFactory::getSession();

jimport( 'joomla.application.module.helper' );

$db = JFactory::getDBO();
$db->setQuery("SELECT params FROM #__modules WHERE module = 'mod_module'");

$module = $db->loadObject();
$moduleParams = new JRegistry();

    $key = $moduleParams->get('vimkey'); 
    $secret = $moduleParams->get('vimsecret'); 
    $token = $moduleParams->get('vimtoken'); 

PHP docs says:

Note: Unlike the double-quoted and heredoc syntaxes, variables and escape sequences for special characters will not be expanded when they occur in single quoted strings.


$token = '$vtoken';

will result in string $vtoken, not 3wsrsdf234mytoken2342werwr. Try to echo $token; and see that it dosen't have value what you expect.

Remove the unneccessary quotes or assign your variables directly from $moduleParams:

$key    = $moduleParams->get('vimkey'); 
$secret = $moduleParams->get('vimsecret'); 
$token  = $moduleParams->get('vimtoken'); 
  • Thank your for the response @Rene. Unfortunately, it did't help. I also tried with double quotes, without quotes and echo. I always get error for double or single quotes You must provide a valid authenticated access token. and without quotes: Php Vimeo information missing
    – Frostbourn
    Jan 26, 2016 at 12:17
  • If you get Php Vimeo information missing, this means that you are going further. So use without quotes and investigate your $vimeo->request.
    – Rene Korss
    Jan 26, 2016 at 12:44
  • I get this string(13) "('vimtoken');" for var_dump of $token = "$moduleParams->get('vimtoken')"; Does this mean that the paramenter isn't get correctly?
    – Frostbourn
    Jan 27, 2016 at 12:17
  • Yes, it means that. Remove quotes.
    – Rene Korss
    Jan 27, 2016 at 12:18
  • So it dosen't get module params. Try print_r($module->params); and see what you get.
    – Rene Korss
    Jan 27, 2016 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.