What I'm trying to do is basically use PHP to upload videos without ever going to youtube itself. Several people need to use a form and be able to upload stuff with all the authentication done server-side. During the upload process, the fact that it's going on Youtube shouldn't even be apparent(not a secret, just want the authentication done without directing to other places).
Like a year or two ago I used this tutorial:
http://www.damnsemicolon.com/php/php-upload-video-youtube-zend-gdata
But it seems as though Google has changed the way they authenticate because it doesn't work anymore. The same thing that worked before now displays:
*"Fatal error: Uncaught exception 'Zend_Gdata_App_AuthException' with message 'Authentication with Google failed. Reason: BadAuthentication'"*
I also got an email from google, which told me they blocked the "suspicious" behavior from my server. I used the Google Unlock Captcha to authorize access, as well as marked the behavior as me. That didn't fix the problem, so either that doesn't do anything or there is something else causing the issue.
I've been trying to build it from the ground up using documentation but I'm not good at understanding those things. Is there an easy fix to the code I used in the first link? Or has google made it impossible to post stuff to your own channel in this manner?
[password and such are correct]
As jlmcdonald pointed out, the authentication API for Youtube has moved away from ClientLogin to oAuth2 exclusively. Check out https://developers.google.com/youtube/v3/guides/moving_to_oauth for more information.
Related
Is it possible to post to Google + through PHP using some kind of API? I've read many conflicting statements on various places, including here on SO.
I've read that you need an analytics account, that you need to add a website to your page, that it isn't possible, that it's a closed service and you must apply, that you need your GMail username & password .etc.
Just really looking for a bit of clarity really. Found this, but I'm not sure if it allows this functionality. The lack of documentation really makes it quite daunting looking into this as well, there is literally nothing I can find at all.
Another option I've found appears to work, however it was from a website where you must pay to download the API. I'm genuinely not sure how or if it can be done.
Google restrict this API to whitelisted partners and companies through https://developers.google.com/+/web/api/rest/pages-signup
You could however use a third party script such as https://gist.github.com/zachbrowne/3301749 which handles the posting as if it was a logged in front end user rather than a direct API update flow.
There are lot of same queries on Stackoverflow but seems no one covered this. So please go through this question.
I was wondering to post on Instagram from webpage via official API but I got to know that there is no provision to do that. Further researching on this function I got a python script with which I was able to post images. Then also I got PHP script to do the same. But with both I need to attach my actual Instagram credentials (which seems okay because official API don't allow to post so that we can get token) and script isn't verifying the credentials.It will only let you know about wrong credentials when you try to post.
On other hand I found few websites :
http://autogrammer.com
http://onlypult.com
http://buffergram.com/
which are allowing the same feature. They also need actual username and password but they are verifying them and let you know instantly if it's wrong.
I am trying to figure out that how they are doing it with (and which) third party script. If anyone know please share your experience.
UPDATE
Moreover I read few user's comments for python script that Instagram push user to change password because they think user's account is compromised.
I've been visiting this forum for years, but this is my first ever question. Any help would be appreciated!
I am writing a web service to pass groups from one application into Facebook and invite the authorised people into them and set a nice pretty cover photo that is generated and stored within the application.
The group creation works splendidly after a fair old bit of head scratching, however, when I try to set the cover image, I am getting a rather useful error message back as below.
OAuth "Facebook Platform" "unknown_error" "An unknown error has occurred."
It's a PHP application on Code Igniter. According to Facebook's delightfully accurate API documentation, this is a simple matter of a cUrl post to 'graph.facebook.com/$groupId' passing the same auth token I just used to create the group and perform the invites and a single JSON encoded parameter of 'cover_url' => $urlOfImage .
A simple task in theory, however, I have spent all day today and a significant chunk of yesterday trying to get this to work without much success.
I have tried posting the image as a Curl object as is necessary in other areas of the Facebook API, and it appears to be trying giving me an error that the image is generating a 404 error (it isn't, when I checked the access logs, it was never requested).
Please be someone out there who has had some success with this.
This has now been fixed by Facebook
So I'm trying to get the latest tweets posted by a user using a PHP script (and caching the results into a text file). I'm using the request https://api.twitter.com/1/statuses/user_timeline.json?count=5&screen_name=google and it's been working fine as a public client, but in order to get better control over my API hit limit I need to authenticate my requests.
I've tried the method shown at https://dev.twitter.com/docs/auth/application-only-auth , but after I successfully connect I get the error "Your credentials do not allow access to this resource" (why ?). So I've tried to use the OAuth method (which looks frighteningly complicated for a hobbyist like me), and downloaded the TwitterOAuth library. But I'm still having trouble connecting ! I put my credentials in the config.php file, but I have no idea where to go from there. The documentation seems to be hinting that I need to manually login to Twitter to authorize the application's connection token... or something. Apparently I need to redirect to some callback URL (what even ?!) and get a short-term connection to enable a long-term connection password which I have to store for later ? What is this madness ?
I was initially under the impression that I could just fetch data from Twitter's RSS feeds but those can't be accessed from scripts for some reason (unlike the Google News RSS feed which fetches just fine). It seems I've gotten myself into something much more complicated than what I signed for. Isn't there an easier (and saner) way of doing this ? Or is nothing decidedly simple ?
I apologize for being such an easily-confused dullard, but my head is spinning.
Thanks !
Edit : after digging around some more I decided to just use PHP curl to fetch the raw page, and then do some Xpath voodoo to get the tweets and the time they were posted at. Of course, this is CPU-intensive, far from stable, and probably not a practice that pleases the folks at Twitter; it also only returns the last 20 tweets (which is thankfully enough for my needs).
However, Cormac Driver's response below about Temboo is certainly a method I'll be investigating next time I need to do something like that.
Temboo provides a simple way of using OAuth to authenticate with Twitter. The process is broken down into two steps:
InitializeOauth. This step returns a Twitter authorization URL that Twitter account holders can visit to grant access to your script.
FinalizeOauth. This step returns the access token that your script will need to make authenticated requests to the Twitter API on behalf of the user.
Full details on how to do this with PHP here: https://www.temboo.com/library/Library/Twitter/OAuth/
You can see an example of how Temboo handles OAuth for Facebook on this page. The PHP source code is provided, and it's almost identical to the code you'll need to do the same thing for Twitter.
(Full disclosure: I work at Temboo)
I am trying to get a list of all Google Apps users of a domain onto a public PHP website (without visitors of the site needing to login or do anything). I have a basic understanding of what needs to happen but can't quite piece it all together. It can't be as hard as it seems to me... could it?
Authentication and Authorization:
I'm pretty sure it needs to use OAuth 2.0 ... but am unsure whether it needs 2 legged or 3 legged. I got another section of the site working with ClientLogin but that won't pull in Google Apps profiles, only user's first and last names (I need the other profile fields). I have set up the API access within the account and have that side of things all set (I believe).
I have found this page, which shows how to construct a URL request to get all Profiles (in every language except PHP of course) but don't understand how to implement this.
http://code.google.com/googleapps/domain/profiles/developers_guide.html
I also tried this example but it just gives me a 401 after I enter the credentials. http://gdatatips.blogspot.com/2008/11/2-legged-oauth-in-php.html
I don't know which frameworks or includes are needed to accomplish this either. I have tried zend, OAuth.php and a whole bunch of other bootstraps... but keep getting lost as to what each is doing.
If someone could help me by outlining:
Which files/framework I need to upload and include as a bootstrap
What variables within those files I need to update with the Google credentials
How I integrate the Google Profiles "Retrieve all Profiles" request with PHP
An ELI5 (explain it like i'm 5) overview would be very much appreciated... I'm sorry for my apparent incompetence, but I have been reading articles for nearly a week and have not gotten anywhere.
Thank you in advance for any help provided.
Good question.
You'll need to implement the Google OAuth 2.0 process as it's described here (experimental?), because someone (you) will need to give your app the initial permissions to access Google Apps API. Steps are:
Register your domain with google (don't remember the link)
Redirect/send browser to an authentication url: https://accounts.google.com/o/oauth2/auth, with the appropriate request params (see the first link). You'll need access_type=offline, your scope would be https://apps-apis.google.com/a/feeds/user/
Get a code back, then exchange for a refresh_token, an access_token, and a value specifying when the access_token will expire. Store these in a database
Whenever you need to make an API call, check if your access_token has expired or not, and refresh when necessary, which is what the refresh_token is for. The refresh_token is valid as long as you don't revoke the access you gave to the app.
OAuth Playground helps a lot. Good luck.