Creating a status update from google hangouts through php - php

So I am trying to figure out if I can create a simple custom PHP script that takes data from a google hangout link and displays back if it is in session.
I am pretty new to Google APi's. My end goal is to create a button on a website that appears whenever someone has joined into a certain designated HANGOUT link.
Do you think this is possible? Any advice would be highly appreciated.
Here was I was thinking:
$stuff = strip_tags(file_get_contents("https://hangouts.google.com/hangouts/_/4im2yhs5kry4vjhlu4yop25tsea"));
$eStrings = explode(' ', $stuff);
I would then retrieve the data from the code and see if it is live or not. If at top of the screen it reads: "You are the only one here" then it is automatically assumed that the session has not begun.
Problem=> You get directed to the google login screen because you need user access.
If anyone has ideas please advise.

While there is a PHP API SDK for Google in beta, it doesn't appear to support Hangouts at all. Google does however expose a client-side JavaScript interface for Hangouts that you should be able to emit and use from your PHP server-side code.
Using the JS interface, you could use the gapi.hangout.onParticipantsChanged event notification for a given Hangout to know when someone has joined.
Then leverage the gapi.hangouts.getParticipants() function to pull a list of who's in the hangout and determine if your button should show for the current user.

Related

Google Calendar API - Not showing calendar

I've downloaded the Google API Client and installed it on my Server. I set up my API and my client ID.
I configured the PHP file and now I'm trying to open it:
http://euotm.net/google-api-php-client/examples/calendar/simple.php
I signin using a Google Account, but then all I get is a code.
WHy does that happen? I need it to show a calendar.
I'm new to this API, so I really don't know much.
Thanks ahead,
Tom.
Indeed google calendar api doesn't provide a display widget to integrate calendar to your application. The api only gives you the possibility to retrieve every details about your calendars and their events, and then you'll have to find a way to display it on your screen if you want a nice layout.
have you
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_CalendarService.php';
these files in your code ? i think you may miss it. what error, you are getting kindly make more sense about this
I am having the same issue. From what I've found so far, it looks like RadASM is right, but I was wondering what you moved on to in terms of which widget/gadget you used to display your actual calendar.
If you haven't found it yet, you may be looking for this:
https://developers.google.com/google-apps/calendar/gadgets/event/
Please let me know what you went with.
RadASM is right. Google Calendar API provides well structured data for the calendars and calendar events, allowing data manipulation, too. Desiring your custom layout, you need to take care of it.
Here is a detailed explanatory article with full demo code within a single HTML file - Easy and compact access to your Google calendars.

How to check user has liked(+1) google+ button on website or url?

How to get like status of google+ button on website or url? I am using PHP.
Unfortunately this isn't quite possible. Neither the REST API nor the PlusOne button itselfs provides a method to check whether a user has +1'd the page or not. Furthermore, if you're using PHP, the user would have to authenticate himself first (using OAuth), so that's probably not what you want, anyway.
What you can do, however, is using Javascript to catch actions of the current visitor. You can specify a callback parameter when creating the +1 button which will be called everytime when the user clicks on the +1 button (source).
While this approach doesn't provide you any information about who the user is (in terms of Google+ user), you could track his actions on your server using a cookie or something else. Or, if that's sufficient, just use the information for the duration of his stay.
if you are trying to get the statistics of your website's +1s, google's webmaster tools will provide the data.
YOu can get this from +1 metric menu in left panel in webmaster tools

How to know if someone is fan of my facebook page?

I know this subject has been done already over and over. but... i must be stupid so i'll try to figure out my problem simply.
I have a facebook page, let s say that one :
http://www.facebook.com/pages/Medieval-Forgecom/302734029745018
with a few fan poeple.
now on my website i would like to give a discount to poeple who are fan of that page.
So i tried the php api (with an application id and secret) before discovering that this is NOT what i want as my page is not an app and has no appId neither secret. Am i misunderstanding something here?
So i m wondering how in php i can know if someone is fan or not...
If it is not possible i could use the javascript api to make this check ( wich is quite bad, it should be done somewhere via php) but even this way i get trouble with the deprecated api and the code refering to javascript inside the facebook website.
in a nutshell, i'm lost.
thanks for your time and attention.
Do some research on the concept of "fan-gate". I think this is what you're looking for.
https://www.facebook.com/note.php?note_id=10150130919053430
http://www.youtube.com/watch?v=fBBnrtG0hAw
There are three ways of using Facebook API. Social plugins are widgets such as comments or like buttons. You can put them into your site directly and easily. And then there is the Graph API. First way of using this API is to create a whole standalone Facebook application, such as Farmwille. Second way is to use it only at your site, out of the Facebook frame. Regardless of the type of your usage, you need to register an application on Facebook, so Facebook API can authorize you. Without that you can't use the API. You don't need to create a real standalone app if you want only to use the API at your own site, but you must register it and this registration is just called Facebook application. It can be virtual application representing your site.

FaceBook php api get realtime updates?

Hi i am trying to use Realtime updates in facebook application,
My application basically backs up the user's photos, messages and friendlist, i want when a user adds a new friend data on server should also be updated, when a user adds a new album the most recent album should be downloaded automatically to my server
I got this code from github-php , but dont know what next?
Please help if anyone has done with real time updates
you need to query the code after certain interval which you can use AJAX to update the page without refresh.
There is no automatic updates without query the information every time.
You have to subscribe using one module and you specify a callback url during the subscription... you only subscribe once and you get updates for everyone who has authorized your app. The updates come to you via the callback url and its very crappy info that basically tells you that you have to go back and query fb to get the full details.

How to login in website using facebook id

I have made a website on which a user has to log in using a username and password. I have seen these in so many website, we can connect through facebook account. And I want to add the same to my web site. How is it possible,using php sdk or the javascript sdk?
The team at Facebook has spent considerable time documenting this, I would suggest you start there:
http://developers.facebook.com/docs/guides/web#login
http://developers.facebook.com/docs/authentication/
If possible, I would do like dracolytch writes here and create a level of abstraction for both OpenID and Facebook. He is willing to share his code.
Those links are what Facebook likes to call "Badges." Go to your profile. Scroll all the way to the bottom. On the lower left hand column you should see a link that says "Create Profile Badge." Click that. From there you can edit a Badge to show the info you'd like. At the end, it will give you some html code that you can copy and paste into another website or blog. When people click on your Badge, they will get sent directly to your Facebook info box.
Source(s):
http://www.facebook.com/badges.php

Categories