Date api for private videos - php

I have the following code
$api = new Dailymotion();
$api->setGrantType(
Dailymotion::GRANT_TYPE_PASSWORD,
$apiKey,
$apiSecret,
array(),
array(
'username' => $username, // don't forget to sanitize this,
'password' => $password, // never use POST variables this way
)
);
$store = $api->get(
'/playlist/'.$playlist_id.'/videos?limit=10&page='.$pageNumber,
array('fields' => array('id', 'title','owner','channel','url','private_id','poster','thumbnail_url','duration')));
Before 3 days this code It worked very fine fine, but now retrieves empty list for private videos from my list on dailyMotion?

Try to see if at least connection to your playlist exists by making a call like this with your own playlist id https://api.dailymotion.com/playlist/x3ecgj/videos?limit=1&page=1.
From your comment it seems, your playlist doesn't have any videos and it is clear now I hope. That is why you are getting back an empty list.

Related

Active Collab API: How to get projects

I'm trying out the ActiveCollab API for my first time. I had to use StackOveflow to figure out how to get the API token since the docs don't tell me this.
Below is my code:
/* GET INTENT */
$url = 'https://my.activecollab.com/api/v1/external/login';
$fields = array(
'email' => "email#email.com",
'password' => "****"
);
$intent = curl_post_connector($url, $fields);
$intent = $intent->user->intent;
/* GET TOKEN */
$url = 'https://app.activecollab.com/my_app_id/api/v1/issue-token-intent';
$fields = array(
'intent' => $intent,
'client_name' => 'My App Name',
'client_vendor' => 'My Company Name'
);
$token = curl_post_connector($url, $fields);
$token = $token->token;
Everything above works and get's the token properly. What I find really weird is that I have to use API v1 to get this, and the docs on ActiveCollab's site don't mention any URL for API v5. It seems like this is the approach everything is taking here on StackOverflow.
Now with the token, I try to get my list of projects:
/* GET PROJECT */
$url = 'https://app.activecollab.com/my_app_id/api/v1/users';
$headers = array (
"X-Angie-AuthApiToken" => $token
);
$projects = curl_get_connector($url, $headers);
var_dump($projects);
But this does not work. There is no error returned - it instead returns an array of languages for some reason! I don't want to paste the massive json object here, so instead I'll link you to a photo of it: https://www.screencast.com/t/7p5JuFB4Gu
UPDATE:
When attempting to use the SDK, it works up until I try getting the token (which is just as far as I got without the SDK). I'm getting Server Error 500, and when looking at the logs, it says:
/home/working/public_html/ac/index.php(21): ActiveCollab\SDK\Authenticator\Cloud->issueToken(123456789)
#1 {main}
thrown in /home/working/public_html/ac/SDK/Authenticator/Cloud.php on line 115
This is line 115 of Cloud.php:
throw new InvalidArgumentException("Account #{$account_id} not loaded");
I honestly don't think I did anything wrong... there must be something wrong with my account ID.
Just for kicks, I commented out that line, and the error disappears and the page loads fine - except now I have no token...

input the data from url Laravel

I need to get the value from link and then add them to DB.
I am working with another developer who created an api as a bridge because he does not know Laravel. Here is the api http://laravel.io/bin/614Xv I am currently passing string valued data like so http://laravel.io/bin/wYry0 and passing the parameters $user, $name, $password through the route.
Here is my route
Route::get('/profile/activated/{user?}/{pass?}/{email?}', array(
'as' => 'invited-user-account-created-get',
'uses' => 'ProfileController#getCreateInvitedUser'
));
Here is my function:
public function getCreateInvitedUser($user=null, $password=null, $email=null) {
$user = Input::get('username', 'abcd');
$pass = Input::get('password', '1234');
$email = Input::get('email', 'asas#gam.com');
//insert $user array in database users table
$user = User::create(array(
'username' => $user,
'password' => $pass,
'email' => $email
));
}
The other developer is wanting me to set the input to the variables I get from the url link/profile/activated/user/pass/email
Maybe I am tired but I am not understanding what he wants me to do and how to grab the variables from the url. The whole reason in doing this is to instantly store the invited guest info in the database when they click the activation link so they do not have to sign up for an account later.
Your route has a problem
Use this instead
Route::get('/profile/activated/{user}/{pass}/{email}', array(
'as' => 'invited-user-account-created-get',
'uses' => 'ProfileController#getCreateInvitedUser'
));
But his idea is totally messed up! Passing password values through a URL, Who does that even?
You sound enlightened, please advise him to try a different approach in whatever thing he's trying to achieve.

LyricAPI - how to get full lyrics?

I want to use LyricAPI hosted on Wikia to get lyrics of songs. But in response I get only part of lyrics:
Await the coming storm, behold the sign in the sun
Chaos upon us spawn! The arrows of time pinpoints us all
Oh, well the maddening laughter growing louder with the memories
Atoms like incense rising, like a thousand candles al[...]
How can I get entire lyrics?
Here is my code:
$client = new SoapClient("http://lyrics.wikia.com/server.php?wsdl", array(
'username' => LYRIC_LOGIN,
'password' => LYRIC_PASS
));
$auth = array(
'username' => LYRIC_LOGIN,
'password' => LYRIC_PASS
);
$header = new SoapHeader('NAMESPACE','Auth',$auth,false);
$client->__setSoapHeaders($header);
$song = $client->getSOTD();
http://api.wikia.com/wiki/Documentation
For legal reasons, the API is not allowed to provide full-lyrics at
the moment. It currently provides a fair-use sample (to verify that
the match is correct) and a link to the page where the full lyrics can
be viewed.

Twitter stream latest tweets not working

I am trying to show the latest tweets on a webpage, but I am unsure of how to do it as I am very new to the twitter api, but here is what I have thus far.
function my_streaming_callback($data, $length, $metrics) {
echo $data;
}
require '../tmhOAuth.php';
$tmhOAuth = new tmhOAuth(array(
'consumer_key' => 'key',
'consumer_secret' => 'secret',
'user_token' => 'token',
'user_secret' => 'secret',
));
$method = 'http://stream.twitter.com/1/statuses//show/:id.json';
//not sure where I am supposed to get the :id from?
$params = array(
//not sure what to put here, I would like to display the last 5 tweets
);
$tmhOAuth->streaming_request('POST', $method, $params, 'my_streaming_callback');
$tmhOAuth->pr($tmhOAuth);
I am using this https://github.com/themattharris/tmhOAuth to authenticate, and then interface with the twitter api, but I am finding it very confusing as all of this is very new to me.
So basically I would just like to try and get the latest tweets, any help would be GREATLY appreciated, as I need to get this done ASAP, thanx in advance! :)
Stream API returns you only the tweets posted after you connected. To get previous tweets you need to use general REST API method: http://dev.twitter.com/doc/get/statuses/show/:id
$tmhOAuth->request('GET', $tmhOAuth->url('1/statuses/show/$id'));
$tmhOAuth->pr(json_decode($tmhOAuth->response['response']));
where $id is the user's id.
If you wish you can use THIS beautiful jQuery plugin. It do the some thing as you require. For more information visit http://tweet.seaofclouds.com/

What happens if Drupal's user_save() fails?

I'm on Drupal 5.x and I'm trying to add new users to the site using a script that calls drupal_bootstrap(). After generating the username, email, password, and role array, I create the new user like so:
$newuser = array( 'name' => $username, 'mail' => $email, 'status' => 1, 'pass' => $password, 'roles' => $roles);
$user = user_save('', $newuser);
I know that with this code I can test the $user object returned by user_save(), but how do I test if the user was created and inserted correctly? Do I have to query the database to test if the user was created successfully?
In drupal 5 it's not easy to see it it fails like in drupal 6. But since it returns a fresh user object from the db, you can inspect it to see if the data was saved properly. So if you try to insert a user and it failed, it will return FALSE.

Categories