I'm trying to build a form that uploads videos to my Dailymotion account.
I built the code myself using the documentation, and I got this error:
Fatal error: Uncaught exception 'DailymotionAuthRequiredException'
with message 'Unsufficient scope for `POST /videos', scope required:
manage_videos, write, delete'
I tried using the script here: http://easyscript4u.blogspot.com/2013/05/how-to-upload-video-on-dailymotion.html
And I get the same error. I looked up the error, and it seems as though you need a token. The documentation doesn't say anything about needing this if you have the password, and that tutorial seemed to work for that dude just fine without it.
I'm thinking this may be a new feature they added so it isn't fully documented. My question is just how do I get a token for this type of request(when I have the user password and everything), and where would I plug it in to the linked script?
Thank you for any help you can provide :)
As mentioned in your error, you need the manage_videos, write and delete scopes to be able to upload a video on Dailymotion. This is detailed in http://www.dailymotion.com/doc/api/authentication.html#requesting-extended-permissions : your application needs to request some specific permissions to its user.
Hence, the line you should change in the code you mention is the following:
$api->setGrantType(
Dailymotion::GRANT_TYPE_PASSWORD,
$apiKey,
$apiSecret,
array('write', 'delete', 'manage_videos'),
array('username' => $testUser, 'password' => $testPassword)
);
It should make it work.
Related
I'm working on an application in PHP using Google YouTube API.
There seems to be a bug in the commentThreads.list resource.
Even the example code on Google developer site for PHP is broken.
( do they even run these scripts before posting ? :-\ this is the
4th script on their site under their examples that is broken not working code.
I have fixed all the other problems myself, but for some reason every time I try, or use an example script I get error 404 back.
Here is the section of code causing the problem.
// Call the YouTube Data API's commentThreads.list method to retrieve video comment threads.
$videoComments = $youtube->commentThreads->listCommentThreads('snippet', array(
'videoId' => $VIDEO_ID,
'textFormat' => 'plainText',
));
and here is the error it produces.
=================================================
A service error occurred: Error calling PUT https://www.googleapis.com/youtube/v3/commentThreads?part=snippet: (404) The specified comment thread could not be found. Check the value of the <code>id</code> property in the request body to ensure that it is correct.
=================================================
but the $VIDEO_ID is good, and works in the script prior to this block of code.
Why can't the comments list for the video be found ?
This fatal error stops the script.
any suggestions ? thanks in advance.
I'm trying to make Youtube v3 Data API work on my website.
I shamelessly copied this code from google's code samples, and it is not working. The error message showed is this:
An client error occurred: All cacheable requests must have creation dates.
I previously had issues with API keys as I forgot almost everything about APIs in general and I just thought this sample would have been useful to remember things. I managed to generate the appropriate key and now I know for sure it isn't the real problem.
Sadly Google didn't find posts related to this issue, except two links to the actual Php Library that I implemented in my site to make everything work. By looking at it closely I noticed a developer comment that could be useful.
$rawDate = $resp->getResponseHeader('date');
$parsedDate = strtotime($rawDate);
if (empty($rawDate) || false == $parsedDate) {
// We can't default this to now, as that means future cache reads
// will always pass with the logic below, so we will require a
// date be injected if not supplied.
throw new Google_Exception("All cacheable requests must have creation dates.");
}
I can understand english pretty well but I really don't know what to do now.
I even tried to add some sort of date in the request in my code, but it isn't working (you can laugh):
// Call the search.list method to retrieve results matching the specified
// query term.
$searchResponse = $youtube->search->listSearch('id,snippet', array(
'q' => $_GET['q'],
'maxResults' => $_GET['maxResults'],
'date' => strtotime(),
));
An client error occurred: (list) unknown parameter: 'date'
Any tips? Thank you in advance
EDIT: I know, this PHP library is currently in beta, but there must be some workaround.
EDIT 2: I found a temporary work around. I inverted the logic gate of that 'if' in the Php Library and now it works. But I don't like doing this, and I won't mark this as solved. At least if you know the reason of the bug please explain it to me, I'm really interested.
I wanted to use WhatsApi (https://github.com/mgp25/WhatsAPI-Official).
I followed the instructions about how to register my number and get a password but it did not work out -> it failed with no_routes error.
I also tried to use the built-in examples - registerTool.php and it also failed.
I got this response:
stdClass Object
(
[status] => fail
[reason] => no_routes
[retry_after] => 3600
)
There was a problem trying to request the code.
Do you know if this tool is still active? Am I using it wrong?
Thanks for the help!
My main problem was how to get the Whatsapp password.
I was not able to do that by registering using the documentation mentioned above (I'm still getting 'no_routes') but I was able to get the password and use the API by following the instructions explained in this post: https://github.com/venomous0x/WhatsAPI/issues/983 .
I still don't know what causes the no_routes problem but with the mentioned post - you can skip the registration part and go on to using the tool.
You can download the latest version of WART i am using WART-1.7.3.0.exe it does all the hardwork and send the Password via SMS or call the number you want to use.
Hope this helps
I have test code to post a comment. The code actually posts the comment correctly, but I'm receiving this error:
Fatal error: Uncaught OAuthException: An unexpected error has occurred. Please retry your request later. thrown in /blah/dee/blah/facebook/src/base_facebook.php on line 1340
This is the code. It works for likes (by changing "comments" with "likes") without error.
require '../facebook/src/facebook.php';
$facebook = new Facebook(array(
'appId' => '0000000000',
'secret' => '000000000000000000000',
));
$response = $facebook->api('/00000000_00000000000001/comments', 'post',
array('message' => 'TEST: Testing comment post.')
);
// all ids have been replaced with 0s, rest assured that I have the correct ids
// in the appropriate places.
I've looked up and down google and duckduckgo. I've seen one reference to this error with the sdk on SO but the answer was to remove the "action" element in the array. I never started with one so I can't remove it.
To be clear, this code WORKS. I have a post on my feed that is littered with "TEST: Testing comment post." comments. However, I can't stop the errors no matter what I do. I tried passing in the access_token as the first element of the array (as I saw someone do somewhere else), but that didn't change anything (didn't think it would because I'm aware that the facebook object stores the access_token internally so you don't have to pass it).
I can put a try/catch around this and continue on, but that's sloppy and doesn't allow for true errors to be handled. Unless there is a way to catch it, test the comment information in the error object is valid and then treat it as a success, but I'm looking for a solution and not a hack (though I'm getting close to a hack at this point).
This issue was fixed per developers.facebook.com/x/bugs/1475816135977009 during a release in October, 2014.
I'm getting the following using the PHP client on my server (connecting via FBML). I've included the appropriate php files (facebook etc..)
Fatal error:
Call to undefined method FacebookRestClient::feed_publishUserAction()
in ..../index.php on line 50
I'm trying to use the example given.
Any ideas?
You might want to take a quick browse/grep through your Facebook API files (facebookapi_php5_restlib.php) and make sure that the feed_publishUserAction() method exists. Perhaps you're using an older version of the API library?
OMG I found the answer
Because the facebookapi_php5_restlib.php that facebook.com provided you is a piece of outdated shit
i.e. you won't be able to find the word feed_publishUserAction in the facebookapi_php5_restlib.php file
HOWEVER, the official facebook smiley demo from this facebook wiki page , contained a more completed facebookapi_php5_restlib.php , along with the feed_publishUserAction function
Which finger would you like to show to the facebook developer staffs?