OAuth Extension Loading in PHP - php

Hi I am really struggling with this one.
I am developing with Google Analytics and Google Adwords; and I am using two separate Oauth libraries in the API Helper Libraries that are written by Google. One is an extension (oauth.so) for Adwords and the other is just a PHP class for Analytics.
When I alter my php.ini file to load the extension, my Analytics OAuth breaks. I think it maybe a conflict of the class names? I have tried changing the name, but haven't had any luck. I had thought that I came up with a solution: Using the dl() function to dynamically load the oauth.so extension on just the Adwords related pages (they are separate scripts):
dl('oauth.so');
Which works great on the command line! But it doesn't work in the browser. I refuse to believe that nobody has come across this issue before. I know that loading the extension from php.ini works in the browser, it just disables the Analytics class. Any one with experience with this, I'd love to hear your input, if you have any suggestions please feel free!
Thank you

The AdWords API PHP client library has been updated to allow for different OAuth libraries:
http://code.google.com/p/google-api-adwords-php/source/detail?r=178
You could even write your own OAuthHandler class that utilized the existing OAuth library that the Analytics library uses.

It's been removed from some SAPI's, either switch to CGI for the webserver (brr), or try to fix the problem with your Analytics PHP class.

Related

PHP: Upgrade Google drive API from V1 to V2 or newer

I am using Google API client 2.0 and want to upgrade Google drive API from V1 to V2 to newer. I not found any straight forward way to upgrade version. Only the change log from google developer site found. Please tell me upgrade process guideline or step by step process.
Thanks in advance.
I am not sure i understand your question. Are you using the V2 of the Google drive api and now you want to upgrade to Google Drive V3? There are a lot of changes your going to have to make I don't think there are any guides on how to do it. Assuming you are using the Google PHP client library your best option will be to download the library for v3 and start fixing your errors one at a time. Like i said there are a number of changes in the library mainly title vs name. That and the library doesn't by default return all the fields your going to have to start using the field parameter.
When you download the library with composer you will be downloading the latest code for use with the Drive API v3. The Authencation code you have been using probably hasnt changed. All of the methods you use in drive probably have. Drive.php
Again there is no upgrade function for this its a completely different API. There is no way to upgrade it. You download the new class using composer and change your code as needed

Google API PHP client with Composer

I made a WP plugin which depends on the Youtube API. So, to do it well, I use Google API PHP client.
My issue is quite simple: the Google API PHP client is huge (more than 12 000 files), including clients for all Google services, when I just need to use Youtube service. So I'm not confortable committing all those files to the WP plugins repo when most of them are useless in my case.
So, right now, my composer.json looks like this:
{
"require": {
"google/apiclient": "^2.0"
}
}
Any way to use only the Youtube API client (using composer if it's possible)?
This is not for the feign of heart but it is doable.
Go to this branch of the repo https://github.com/google/google-api-php-client/tree/v1-master
Grab the full src/Google directory you will need all of that.
In the src/Google/Service directory is the stuff for all the different APIs. Remove everything except for YouTube.
cross your fingers it should work.
This wont remove all 12000 files but it should give you just what you absolutely need. I used to do this but its been a few years.
Unfortunately, I don't think this is possible without manually including the relevant files in your project (which is a really bad idea).
The reason why its impossible, is because Google places all service APIs for the PHP library in a single GitHub repository found here:
https://github.com/google/google-api-php-client-services
If Google does split them into multiple repositories, then it could be possible to include a single repo.
For now, though, all services are under one composer project and one repo. Maybe its worth making a GitHub issue to ask Google about this?

Google Moments in google's own php library, are not working

I have struggled with google's php library, the latest version of which is available on their own website. While the simple google plus example they provide works fine (it's a basic login with GET features), there is no way to add a moment activity via app in php - at least not for me.
Their own example isn't working (the example can be retrievd in the library: examples/moments/simple.php)
Someone provides an answer here but the button demo they provide isn't working either if I press (authorization is fine, posting produces no action.
Does anyone have a suggestion on how to change their own php file so to make it work? I tired removing all the code and resetting it to the basic action: at least I am not getting oauth or php errors, but the file produces no action.
I understand that posting moments in php is not currently supported, but I have a web app and android implementation wouldn't work for me I think.
At the moment you need to get the library from the trunk, you can find instructions here.
This gist documents how to request permission and write activities.
The old moments api has been deprecated and those samples are for the old API, I'll remove them from the codebase as soon as possible. Thanks for raising this question!

php library or client for a caldav server

i've set up a caldav server in particular http://radicale.org/ and now i would to integrate a jquery calendar like http://themouette.github.com/jquery-week-calendar/weekcalendar.html but the problem is the interface in php.
so the question is:
there is a library written in php to interact with radicale server or just another caldav server? How is possible to create, modify and delete events?
I do not know how the protocol works, but I thought that you could use curl.
Best regards
Claudio
If you're looking for a decent SabreDAV Wrapper, you should try http://baikal.codr.fr
It's lightweight, full PHP, and features a nice web admin for managing contacts and calendars.
I use SabreDAV, a PHP framework for Web/Cal/CardDAV. It defines backends you have to implement in order to create your own server. It's full featured and probably the best lib In PHP.
It works fine and I also use the same calendar ;)

Any good OpenID php consumer libs?

I need a php lib that can auth using OpenID against sites offering this service, like Google, Yahoo, Wordpress, etc...
Anyone used any lib that actuallly works? I've tryied a few but couldn't get any to auth against Google, Yahoo, or Wordpress.
I would highly recommend LightOpenID by Mewp. It comes with a great example and has no unusual dependencies (the only requirement you need to be aware of is that of the CURL PHP extension). It's entirely self-contained, it's only one file, and the code is very readable. There are more tasty details.
Zend.OpenID
With Zend Framework, you can simply use the Zend_OpenID component without having to use the MVC functionality or any configuration files that are not concerned with OpenID
phpOIDC implements both consumer and provider for OpenID connect.
OpenID connect is a new spec that was released in 2014 and is worth looking at.

Categories