Youtube devicesupport through PHP - php

For some reason when I call the following code:
echo file_get_contents('http://gdata.youtube.com/feeds/api/videos/wGG543FeHOE?v=2&alt=json');
I get the following image: http://i.ytimg.com/vi/UKY3scPIMd8/sddefault.jpg
This was working a few days ago - have Youtube started to restrict PHP access to their API?

For anyone else who gets this problem - see https://developers.google.com/youtube/v3/getting-started. Basically they've deprecated the free4all api and are now limiting it to token access. Its quite easy to get a token and once you have one just call:
https://www.googleapis.com/youtube/v3/videos?id=ID&key=YOUR__KEY&part=snippet,contentDetails,statistics,status

Related

mapbox start returning error Token doesnt have access to layer_name without reason

Hi I have simple code that get all features in a radius from specific layers.
the tileset is a custom one I made
that code worked without any problem for few months
suddenly I start getting from mapbox error like:
Not Authorized - Token doesnt have access to *layerName*
the code look as simple as
use Illuminate\Support\Facades\Http;
public function featuresInPoint($lon,$lat,$radius=0,$geometryTypes='polygon',$layers='neighborhoods'){
$response = Http::get('https://api.mapbox.com/v4/username.map/tilequery/'.$lon.','.$lat.'.json' . '/?access_token=' . $this->token.'&radius='.$radius.'&geometry='.$geometryTypes.'&layers='.$layers);
return $response;
}
as I said it work without problem for a few months and suddenly it stopped working without me change anything, I tried to create new mapbox api token with all the scopes available and still getting this error
if I changed the tileset to some Mapbox Tilesets like "mapbox.mapbox-streets-v8" it works, but when I use custom one its not work(until 3 days ago when it worked)

Trying to add Google sign in api to octobercms

I'm using OctoberCMS based on Laravel freamwork.
I would like to have option on my website "sign in with google account".
So I went to https://developers.google.com/identity/sign-in/web/devconsole-project
and I fallowed all of the steps to "Authenticate with a backend server".
Becouse I don't have ssh access to my domain ( I cannot install library using Composer), so I downloaded Google API Client Library for php in .zip .
I unpacked it to 'plugins/nameOfMyplugin/google'.
And I got stuck,becouse I don't have any idea how to Send the ID token to my server and to validate it with those library, then I would like to create new user in my db if not exist in my rainlab.user.plugin.
Thank You for any help.
I have solved it.
In octoberCMS there is no reason for connect with google api by Your own, better solusion is download already made plugin(octobercms.com/plugin/flynsarmy-sociallogin) which is working.
I just downloaded octobercms.com/plugin/flynsarmy-sociallogin, but as I said it before, got some problems with login into my website.
I sow that each 12 minutes break between log out and log into my website I can login. When I tried to log into after in 11 minutes after log out it didn't work.
I went to my backend/ settings / logs /event logs and sow that
Cannot handle token prior to 2017-04-19T08:27:14+0000 in public_html/plugins/flynsarmy/sociallogin/vendor/firebase/php-jwt/src/JWT.php on line 124.
It's mean that my server time have 12 minutes late.
There are 2 ways to solve it:
First one not good for safety reasons:
SET in plugins/flynsarmy/sociallogin/vendor/firebase/php-jwt/src/JWT.php
public static $leeway = x;
Where x are secunds, in my example
or add difference of time in this if in from 123 :
if (isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway +
**720**)) {
throw new BeforeValidException('Cannot handle token prior to ' . date(DateTime::ISO8601, $payload->iat)
);
}
But as I said... it's not safety...
Second solution is to set time on server in right way.
There is a lot of solutions how to do it:
http://www.inmotionhosting.com/support/website/php/update-local-php-settings
https://help.directadmin.com/item.php?id=52
http://forum.directadmin.com/showthread.php?t=1817

Google Plus PHP api - Insert Moments not working

I want to share my status to google plus.
I followed the google api, but i am getting the unauthorized error. I am trying to fix it for more then 2 days, but i could't..
i read this answer, i download and test the api, still not working for me.
401 Unauthorized access when posting Google+ Moments with PHP Client
You can check here,
https://code.google.com/p/google-api-php-client/source/browse/trunk/examples/moments/simple.php
In this trunk file, still they are calling the Google_PlusMomentsService.php
i tried the following code, but still not works - https://developers.google.com/+/api/latest/moments/insert
here is the live link which i am testing: http://webscarlets.in/projects/babblesuite/gplus/index.php
this is code i am using to share the status
$target = new Google_ItemScope();
$target->url = 'https://developers.google.com/+/plugins/snippet/examples/thing';
$moment = new Google_Moment();
$moment->type = "http://schemas.google.com/AddActivity";
$moment->target = $target;
// Execute the request
$moments->moments->insert('me', 'vault', $moment);
print '<p>Created an AddActivity moment</p>';
can anyone fix it please.
Thanks to all
You need to authorize the user in the PHP client and request visible actions (e.g. AddActivity) before you can write app activities to a user's profile. Because you're using the older sample, you probably aren't setting requestvisibleactions either in the button or in your OAuth2 flow.
Try starting here:
https://developers.google.com/+/quickstart/php
This is the latest PHP starter and has been verified to work. If you really, really, want to use the older code you've shared, please share the sign-in button markup, e.g.:
<span id="signinButton">
<span
class="g-signin"
data-callback="signinCallback"
data-clientid="CLIENT_ID"
data-cookiepolicy="single_host_origin"
data-requestvisibleactions="http://schemas.google.com/AddActivity"
data-scope="https://www.googleapis.com/auth/plus.login">
</span>
</span>
Because I'm guessing you're missing the line: data-requestvisibleactions...

trying to connect to viagogo API using oAuth

I've been trying to access the viagogo API but I get a 500 error, i'm using the code sample here:
www.dropbox.com/s/8fqfkkmdcvjtzxt/apipublicaccess.php
Surprisingly, this code works fine here:
http://mynameisroman.com/apipublicaccess.php
but not here :
http://www.smapin.com/apipublicaccess.php
Any ideas ?
thanks a lot !
You do realize that you need to change the following lines of code to contain valid Consumer Key and Consumer Secret.
$VIAGOGO["CONSUMERKEY"]="3o*******0jUQ";
$VIAGOGO["CONSUMERSECRET"]="Cv3*************dx0J";

Call to undefined method in facebook call to publishUserAction

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?

Categories