I would like to reach this in steps:
-Upload a video to youtube using php and Youtube API v3
-After the video is uploaded, I wold like to auto post the video link and video title to the twitter, using codebird libery.
What I have at this time:
require_once ('codebird.php');
\Codebird\Codebird::setConsumerKey('YOURKEY', 'YOURSECRET'); // static, see README
$cb = \Codebird\Codebird::getInstance();
$cb->setToken('YOURTOKEN', 'YOURTOKENSECRET');
// Call set_include_path() as needed to point to your client library.
require_once 'Google/autoload.php';
require_once 'Google/Client.php';
require_once 'Google/Service/YouTube.php';
session_start();
set_time_limit(0);
//More code for youtube uploading.............
// The point varibles:
htmlBody .= "<h3>Video Uploaded</h3><ul>";
$htmlBody .= sprintf('<li>%s (%s)</li>',
$status['snippet']['title'],
$status['id']);
Post to twitter:
$params = array(
'status' =>"https://www.youtube.com/watch?v=".$status['id'], $status['snippet']['title'],
);
$reply = $cb->statuses_update($params);
And the erorr is what I get in the page:
An client error occurred: The OAuth 2.0 access token has expired, and a refresh token is not available. Refresh tokens are not returned for responses that were auto-approved.