Getting different results between PHP SDK and Graph API explorer - php

I'm facing the following problem:
When I'm trying to read all the comments from a posto of me on facebook via the Facebook php sdk ( Graph API) i can't get all of them, while when I am using the Facebook Graph API explorer, they are all appearing.
My App's permissions are the same with Graph API explorer's permissions.
Any ideas?
Thanks..

Are you authenticating as a user in your PHP app? In the Graph API explorer, by default you have a user access token. If your app is just using the app id & secret, you will not see any post marked with a privacy less than "everyone."
You can test this in the explorer by getting an app access_token and pasting this into the access token box in the graph explorer.

in the Graph API Explorer, try to change Application (by default is Graph API Explorer) with your App.
if still can't get all of the comments, just delete you App, and recreate.

Related

need assistance in google drive api oauth 2 without playground

I am using the Google API Playground to auth my PWA and get tokens to upload files to google drive from the PWA.
I'm using the Google Drive API, but the refresh token that I got from the Playground is expiring after one week. This causes us to go through the whole process from playground again.
I don't have this problem with other APIs, such as Dropbox, where the app refresh tokens aren't expiring and can be used to generate a new access token.
I am looking for help in:
Authorizing my PWA and get code in php using curl
Get a refresh token through my PWA without a consent screen
Lets take this step by step
I'm using the Google Drive API, but the refresh token that I got from the Playground is expiring after one week.
I am going to assume that you are using your own client id and client secret within Playground.
If this is the case then the reason it is expiring after a week is that your app is still in the testing phase. To fix that you can go to google cloud console under the oauth2 consent screen and switch your app to prodctuion.
Request a new refresh token and it should not expire.
If you are not using your own client id then the reason its expiring is that developer console is not intended for production use its just for testing. Stop using it in that manner.
Get a refresh token through my PWA without a consent screen
If you only connecting to a single google drive account then you should consider using a service account. A service account is intended for server to server authorization its pre authorized. You can share a folder with a service account and the service account will have access to that folder without requesting a user grant consent. It will just work.

how to read facebook profile timeline feed with Graph API?

I am using Facebook PHP-SDK v5 with Facebook Graph API v2.10 and by other code i am able to get data from facebook page easily, but what i need is to fetch data of user profile wall ,
from facebook Graph Explorer i am able to read those data by generating token. but not by code.
it will throwing error
URL blocked: This redirect failed because the redirect URI is not white-listed in the app's client OAuth settings. Make sure that the client and web OAuth logins are on and add all your app domains as valid OAuth redirect URIs.
and i have used localhost url in the app oAuth setting as well,
I wanted to read someones wall post feed after authorize him by my applications, i dont want to read my own profile like api('/me/feed'
does anyone help me in this case.

Android app - Facebook SDK login from PHP rest webservice

I am developing an android application. In that I am using the Facebook SDK to share the messages and photos.
Facebook login and sharing is working fine in all devices except the HTC device. I have search over the internet about this issue. But I didn't get any solution.
So I am planning to use PHP rest web service to facebook login and sharing. (i.e) Get the facebook credentials from my android app and pass it into the PHP rest web service to get login. And same way to share photo in facebook.
Is it possible to do that?
If yes, Can you give some samples to do that?
If No, What difficulties I will face?

Uploading Video to Youtube channel with HybridAuth and PHP

I would like to grant an application permissions to post video to my youtube channel using HybridAuth (http://hybridauth.sourceforge.net/) and PHP.
First question is that possible?
I can already authenticate and grant permissions facebook, linkedin, and twitter. I can post status to these networks. Have not tried connecting to Google yet, but should be easy to add, and I am assuming that I only need Google authentication to access Youtube?
What part of HybridAuth can be used to upload the video? Are there any sample apps out there that I can use to learn from? Has anyone done this?
No, you can't use it with Youtube, however can use it with Vimeo.
You can use HybridAuth to connect to Google API and Register your Application / Projet in Google ( HybridAuth already enables Connection to Google , see Documentation for reference ) and When you register your projet with Google , you can start to add / Enable the right Google API by browsing API List Items available. You will find an API Called YouTube Data API v3 , Click on it and Enable to Change Status to ON.
Once done , then your registered projet with Google enables YouTube API , and you have to go to Credentials to generate your keys.
Hopes it helps ...
Here is a usefull link for you to get Started with YouTube through Google :
Source : https://developers.google.com/youtube/registering_an_application
Title : Register your Application with YouTube via Google
Go to the Google Developers Console.
Select a project.
In the sidebar on the left, select APIs & auth. In the list of APIs, make sure the status is ON for the YouTube Data API v3.
In the sidebar on the left, select Credentials.
The API supports two types of credentials. Create whichever credentials are appropriate for your project:
OAuth 2.0: Your application must send an OAuth 2.0 token with any request that accesses private user data. Your application sends a client ID and, possibly, a client secret to obtain a token. You can generate OAuth 2.0 credentials for web applications, service accounts, or installed applications.
Learn more
API keys: A request that does not provide an OAuth 2.0 token must send an API key. The key identifies your project and provides API access, quota, and reports.
If the key type you need does not already exist, create an API key by selecting Create New Key and then selecting the appropriate key type. Then enter the additional data required for that key type.

PHP Facebook API

Aarg, can't find a good answer to this question:
How can I auto-login on Facebook (knowing the username/password from a user) and then post a message on the wall? I already downloaded facebook.php, base_facebook.php and other files, but I don't how I can get this working...
You will need to create a facebook app. This will give you the appId and secret that are required to do most things with the graph api.
You don't even need the username and password of the user, they can authorise your app to post to their wall.
You can find all the info https://developers.facebook.com/docs/
You can use the facebook graph api and oauth to post on the facebook wall of a user.
Facebook's API does not support authentication via a user's email and password. You don't need facebook.php, or base_facebook.php. What you need is PHP and cURL to mimic browser HTTP requests and login to Facebook manually.
Try logging in to http://m.facebook.com and use Firefox's Firebug Addon or Chrome's Developer Tools to monitor browser requests.

Categories