megawubs / trakt-api-wrapper

A Object Oriented PHP wrapper for the trakt api
34 stars 19 forks source link

trakt.tv API v2 support #2

Closed m-vdv closed 9 years ago

m-vdv commented 10 years ago

As you might be aware, trakt will be getting a major update and there's a new API coming (v2). There's a Google+ community setup by the people of trakt with info. You may want to send Justin an email: justin@trakt.tv to get access to the community if you aren't in it already. It has a link to the new api docs (http://docs.trakt.apiary.io/) and you can discuss the methods ect there.. Would be awesome if you could update your php wrapper to support this new v2 api!

CptChaos commented 9 years ago

Would love to see this, now the new API is in use. :)

megawubs commented 9 years ago

I'll see what I can do, don't have as much free time as when I created this wrapper.

m-vdv commented 9 years ago

@megawubs Thanks Bram! :)

ronilaukkarinen commented 9 years ago

+1 Much needed. Didn't really find another well documented php wrapper for Trakt.

megawubs commented 9 years ago

I'm looking into this. I think of doing a complete rewrite and use packages like league/oauth2-client, guzzlehttp/guzzle and nesbot/carbon. Currently looking into the whole oauth2 thing, can't really wrap my head around it.

megawubs commented 9 years ago

I've put a few things together today. Far from finished but it's a solid basis. You can find it here. Any thoughts are welcome!

m-vdv commented 9 years ago

Many thanks Bram! I'm going to experiment with it asap :)

ronilaukkarinen commented 9 years ago

Thanks! I feel a little dumb and sleep deprived here, but -humbly- can you add step by step instructions to how to use (with oauth and all)? that could save time. Used a jquery version of Trakt (just url call) before v2 and with trakt PHP wrapper I'm a bit lost at first...

megawubs commented 9 years ago

I wrote the code last night, didn't have time to document it properly. Will do that later today.

Op ma 23 feb. 2015 12:27 AM schreef Roni Laukkarinen < notifications@github.com>:

Thanks! I feel a little dumb and sleep deprived here, but -humbly- can you add step by step instructions to how to use (with oauth and all)? that could save time. Used a jquery version of Trakt (just url call) before v2 and with trakt PHP wrapper I'm a bit lost at first...

— Reply to this email directly or view it on GitHub https://github.com/megawubs/trakt-api-wrapper/issues/2#issuecomment-75471436 .

m-vdv commented 9 years ago

@megawubs Hey Bram, just checking in to see how develoment is going. If you got some time for documentation that would be helpfull for all of us too :)

megawubs commented 9 years ago

Hey, it's coming. I'm still a student and currently school requires my attention.

megawubs commented 9 years ago

Had some free time tonight, check the readme

ronilaukkarinen commented 9 years ago

Thanks! installed through composer, added autoload and now I have a couple of questions: API key has changed its location since I last looked at it, I guess it's the callback code in http://trakt.tv/oauth/applications? I'm getting no results, but no errors either with Get request example. var_dump($res) doesn't output anything either.

Any tips?

megawubs commented 9 years ago

The composer package still points to the master branch. For now, I recommend manually installation. I have no idea how to tell composer about other branches. Will dive into that when I get the time and update the docs.

Op do 12 mrt. 2015 8:05 PM schreef Roni Laukkarinen < notifications@github.com>:

Thanks! installed through composer, added autoload and now I have a couple of questions: API key has changed its location since I last looked at it, I guess it's the callback code in http://trakt.tv/oauth/applications? I'm getting no results, but no errors either with Get request example. var_dump($res) doesn't output anything either.

Any tips?

— Reply to this email directly or view it on GitHub https://github.com/megawubs/trakt-api-wrapper/issues/2#issuecomment-78573162 .

megawubs commented 9 years ago

I've been doing some householding and merged the branch api-version-2 into the develop branch. After this I removed the branches wrap-classes, api-version-2.

@ronilaukkarinen I think you can now do add "wubs/trakt": "dev-develop" to your composer dependancies and you'll have the api version two wrapper.

If you already have the version 2 wrapper, you should indeed get an api token by running this in your browser and use urn:ietf:wg:oauth:2.0:oob as your redirect url.

<?php

$trakt = new Trakt($clientId, $clientSecret, $redirectUrl);
$trakt->authorize();

This will show your authorization code on the Trakt site. Copy the code and you can do:

<?php
$token = $trakt->getAccessToken($code);
var_dump($token); // displays the token, type, expires, refresh token and the scope

Now you can use the values inside $token. Store them somewhere (I use a .env file for development). If it's user specific, store it in a database. Now you can create a AccessToken with the TraktAccessToken::create($token, $type, $expires, $refresh_token, $scope) method.

I hope this helps.

megawubs commented 9 years ago

The Master branch is now the api v2 wrapper, it's still in development but the basics are there. I'm going to close this issue. If anyone has problems or ideas with the v2 wrapper, start a new issue. The v1 wrapper is still available in the 1.0 branch.

ronilaukkarinen commented 9 years ago

Oh, it needs PHP 5.4 or newer, didn't say in the dependencies. Errored and had errors disabled... I have 5.3.10 (yeah, it's old but stable). I guess I have to update.

ronilaukkarinen commented 9 years ago

Managed to get it working, though I don't need oauth especially. Trying to get recently watched episodes/movies. Any example code about that? PHP and v2 are way different than previous v1 JSON query used to be. There's no CORS support yet so I can't use jQuery just yet.

megawubs commented 9 years ago

What's making it crash on 5.3?

ronilaukkarinen commented 9 years ago
Parse error: syntax error, unexpected '[' in /var/www/test/vendor/wubs/trakt/src/Wubs/Trakt/Trakt.php on line 44

PHP docs: "As of PHP 5.4 it is possible to array dereference the result of a function or method call directly. Before it was only possible using a temporary variable."

megawubs commented 9 years ago

What php version are you using?

Op di 24 mrt. 2015 18:22 schreef Roni Laukkarinen <notifications@github.com

:

Parse error: syntax error, unexpected '[' in /var/www/test/vendor/wubs/trakt/src/Wubs/Trakt/Trakt.php on line 44

— Reply to this email directly or view it on GitHub https://github.com/megawubs/trakt-api-wrapper/issues/2#issuecomment-85606849 .

megawubs commented 9 years ago

Never mind that las reaction. It's the new array notation. Don't know if I'm going to change that. Let me think about it.

ronilaukkarinen commented 9 years ago

Like I stated in my previous comment, I have 5.3.10 on my dev server. Gladly, on my other test server I have PHP 5.5.22, so this is not a deal-breaker.

I'm still stuck:

[...] trying to get recently watched episodes/movies. Any example code about that?
megawubs commented 9 years ago

That request isn't written just yet. Have been really busy writing request objects for all requests. I'm currently at all the request starting with shows. It's a lot to cover. Actually, making a request object is't that hard.

I'll create this one right now.

megawubs commented 9 years ago

I just quickly created the request object for you. You can use it like this:

<?php
use Wubs\Trakt\Request\Parameters\Type;
use Wubs\Trakt\Request\Parameters\Username;
use Wubs\Trakt\Request\Users\History;

$parameters = [Username::set('megawubs'), Type::movies()];
$response = History::request($clientId, $parameters);

Note, I haven't added a response handler just yet, it just returns the JSON parsed as plain php objects.

ronilaukkarinen commented 9 years ago

Wow, thanks for that! However, I get

Fatal error: Class 'Username' not found
ronilaukkarinen commented 9 years ago

My code:

<?php 
error_reporting(E_ALL);
ini_set("display_errors", 1);

require 'vendor/autoload.php';

use Wubs\Trakt\Trakt;
use Wubs\Trakt\Request\Users\History;

$token = 'XXXXX';

$parameters = [Username::set('rolle'), Type::movie()];
$response = History::request($clientId, $token, $parameters);

?>
megawubs commented 9 years ago

Oh, my mistake. Forgot to add the use statements of Wubs\Trakt\Request\Parameters\Type; and Wubs\Trakt\Request\Parameters\Username; Updated the preview.

As of now (3127eda72f556d7bde139352513f0569ff59c759) you can omit the $token variable on requests that do not need a token.

ronilaukkarinen commented 9 years ago

Thank you! Tested with this

<?php 
error_reporting(E_ALL);
ini_set("display_errors", 1);

require 'vendor/autoload.php';

use Wubs\Trakt\Request\Parameters\Type;
use Wubs\Trakt\Request\Parameters\Username;
use Wubs\Trakt\Request\Users\History;
use Wubs\Trakt\Trakt;

$clientId = 'XXXXX';
$token = 'XXXXX';

$parameters = [Username::set('rolle'), Type::movie()];
$response = History::request($clientId, $token, $parameters);
?>

Got this:

Catchable fatal error: Argument 1 passed to Wubs\Trakt\Request\AbstractRequest::request() must be an instance of Wubs\Trakt\ClientId, string given, called in /home/rolle/public_html/index.php on line 42 and defined in /home/rolle/public_html/vendor/wubs/trakt/src/Wubs/Trakt/Request/AbstractRequest.php on line 139

Tried with use Wubs\Trakt\ClientId; but no dice. Don't know how to work with classes so can't really figure this out myself.

megawubs commented 9 years ago

Do $clientId = ClientId::set(your-id-here); Sorry, it’s my fault for not being explicit enough. This really teaches me to how to explain and document the things :)

ronilaukkarinen commented 9 years ago

Not to worry, happy to test!

Current code:

<?php 
error_reporting(E_ALL);
ini_set("display_errors", 1);

require 'vendor/autoload.php';

use Wubs\Trakt\Request\Parameters\Type;
use Wubs\Trakt\Request\Parameters\Username;
use Wubs\Trakt\Request\Users\History;
use Wubs\Trakt\ClientId;
use Wubs\Trakt\Trakt;

$clientId = ClientId::set('XXXXX');
$token = 'XXXXX';

$parameters = [Username::set('rolle'), Type::movie()];
$response = History::request($clientId, $token, $parameters);

?>

Result:

Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error response [url] https://api-v2launch.trakt.tv/users/rolle/history/movie [status code] 405 [reason phrase] Method Not Allowed' in /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:89 Stack trace: #0 /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/Subscriber/HttpError.php(33): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Message\Request), Object(GuzzleHttp\Message\Response)) #1 /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/Event/Emitter.php(109): GuzzleHttp\Subscriber\HttpError->onComplete(Object(GuzzleHttp\Event\CompleteEvent), 'complete') #2 /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/RequestFsm.php(91): GuzzleHttp\Event\Emitter->emit('complete', Object(GuzzleHttp\Event\CompleteEvent)) #3 /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/RequestFsm.php(132): GuzzleHttp\RequestFsm->__invoke(Object(GuzzleHttp\Transaction)) #4 /home/rolle/public_html/ven in /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 89

What's up this time? :grin:

megawubs commented 9 years ago

You should not pass an access token if you don't have one. Just give it your client id and the parameters, that should work.

Will update the readme with a better explanation of this. Otherwise, look inside the test/RequestTest.php the code inside the second test in that class is exactly what you need.

megawubs commented 9 years ago

And you should use Type::movies() as that url only accept plural names for media types.

ronilaukkarinen commented 9 years ago

Wow, it works now! Awesome. The "last watched" part on my websites have been under construction since January. Will implement this during the weekend. For episodes I suppose a simple if sentence will do. Thanks a lot!

ronilaukkarinen commented 9 years ago

Hmm, there is not yet method for episodes? Also my if sentence would not work, because they are not in the same array with episodes so first is always a movie and I cannot check is episode set. Any way to get combined history stream out with some parameter?

ronilaukkarinen commented 9 years ago

Hi @megawubs, so is there a way to get recently watched (episodes + movies)?

megawubs commented 9 years ago

Hi @ronilaukkarinen I just pushed some of my local changes that still had to be pushed. It includes the recently watched request.

<?php

use Wubs\Trakt\ClientId;
use Wubs\Trakt\Request\Parameters\Type;
use Wubs\Trakt\Request\Parameters\Username;
use Wubs\Trakt\Request\Users\History;

 $clientId = ClientId::set(getenv("CLIENT_ID"));

$parameters = [Username::set('megawubs'), Type::movies()];
$response = History::request($clientId, $parameters);

var_dump($response);
ronilaukkarinen commented 9 years ago

Thanks for the answer. Tried with this (with client id set of course):

<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);

require 'vendor/autoload.php';

use Wubs\Trakt\ClientId;
use Wubs\Trakt\Request\Parameters\Type;
use Wubs\Trakt\Request\Parameters\Username;
use Wubs\Trakt\Request\Users\History;

$clientId = ClientId::set(getenv("MY_CLIENT_ID_IS_SET_HERE"));

$parameters = [Username::set('rolle'), Type::movies()];
$response = History::request($clientId, $parameters);

echo '<pre>';
echo var_dump($response);
echo '</pre>';

?>

My composer.json row (just now composer update):

{
  "name": "peikko",
  "description": "Peikko.us website",
  "authors": [
    {
      "name": "Roni Laukkarinen",
      "email": "roni@dude.fi"
    }
  ],
  "minimum-stability": "dev",
  "require": {
    "wubs/trakt": "*"
  },
  "require-dev": {
    "phpunit/phpunit": "4.4.*"
  },
  "autoload": {
    "psr-0": {"Wubs": "src/"}
  }
}

I get:

Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error response [url] https://api-v2launch.trakt.tv/users/rolle/history/movies [status code] 403 [reason phrase] Forbidden' in /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:89 Stack trace: #0 /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/Subscriber/HttpError.php(33): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Message\Request), Object(GuzzleHttp\Message\Response)) #1 /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/Event/Emitter.php(109): GuzzleHttp\Subscriber\HttpError->onComplete(Object(GuzzleHttp\Event\CompleteEvent), 'complete') #2 /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/RequestFsm.php(91): GuzzleHttp\Event\Emitter->emit('complete', Object(GuzzleHttp\Event\CompleteEvent)) #3 /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/RequestFsm.php(132): GuzzleHttp\RequestFsm->__invoke(Object(GuzzleHttp\Transaction)) #4 /home/rolle/public_html/vendor/reac in /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 89
megawubs commented 9 years ago

Do you have a public account or not?

Op ma 1 jun. 2015 22:46 schreef Roni Laukkarinen notifications@github.com:

Thanks for the answer. Tried with this (with client id set of course):

<?php

error_reporting(E_ALL); ini_set("display_errors", 1);

require 'vendor/autoload.php';

use Wubs\Trakt\ClientId; use Wubs\Trakt\Request\Parameters\Type; use Wubs\Trakt\Request\Parameters\Username; use Wubs\Trakt\Request\Users\History;

$clientId = ClientId::set(getenv("MY_CLIENT_ID_IS_SET_HERE"));

$parameters = [Username::set('rolle'), Type::movies()]; $response = History::request($clientId, $parameters);

echo '

';
echo var_dump($response);
echo '
';

?>

My composer.json row (just now composer update):

{ "name": "peikko", "description": "Peikko.us website", "authors": [ { "name": "Roni Laukkarinen", "email": "roni@dude.fi" } ], "minimum-stability": "dev", "require": { "wubs/trakt": "" }, "require-dev": { "phpunit/phpunit": "4.4." }, "autoload": { "psr-0": {"Wubs": "src/"} } }

I get:

Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error response [url] https://api-v2launch.trakt.tv/users/rolle/history/movies [status code] 403 [reason phrase] Forbidden' in /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:89 Stack trace: #0 /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/Subscriber/HttpError.php(33): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Message\Request), Object(GuzzleHttp\Message\Response)) #1 /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/Event/Emitter.php(109): GuzzleHttp\Subscriber\HttpError->onComplete(Object(GuzzleHttp\Event\CompleteEvent), 'complete') #2 /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/RequestFsm.php(91): GuzzleHttp\Event\Emitter->emit('complete', Object(GuzzleHttp\Event\CompleteEvent)) #3 /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/RequestFsm.php(132): GuzzleHttp\RequestFsm->__invoke(Object(Guzz leHttp\Transaction)) #4 /home/rolle/public_html/vendor/reac in /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 89

— Reply to this email directly or view it on GitHub https://github.com/megawubs/trakt-api-wrapper/issues/2#issuecomment-107701719 .

ronilaukkarinen commented 9 years ago

Yep: http://trakt.tv/users/rolle/history

megawubs commented 9 years ago

That's odd, this request should not require an auth token. Can you add an auth token to the request and see if it succeeds?

ronilaukkarinen commented 9 years ago

I still get the same error, when using this:

<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);

require 'vendor/autoload.php';

use Wubs\Trakt\Trakt;
use Wubs\Trakt\ClientId;
use Wubs\Trakt\Request\Parameters\Type;
use Wubs\Trakt\Request\Parameters\Username;
use Wubs\Trakt\Request\Users\History;

$clientId = ClientId::set(getenv("xxxxx"));
$clientSecret = ClientId::set(getenv("xxxxx"));
$redirectUrl = "";

$trakt = new Trakt("xxxxx", "xxxxx", "urn:ietf:wg:oauth:2.0:oob");
// $trakt->authorize();
// $token = $trakt->getAccessToken("xxxxx");
$accesstoken = "xxxxx";

$parameters = [Username::set('rolle'), Type::movies()];
$response = History::request($clientId, $accesstoken, $parameters);

echo '<pre>';
echo var_dump($response);
echo '</pre>';

?>

Codes should be right. Did I do something wrong?

megawubs commented 9 years ago

My bad. The access token should be an instance of League\OAuth2\Client\Token\AccessToken. Recent changes removed the type check on AbstractRequest::request(). And the lack of documentation is also the problem here. Well, good news! Today I got my lasts results back and I'm done with school for this year, meaning I can finally move on with this project :)

When you use .env environment variables, you can use this helper function I wrote for testing purposes.

<?php

use Wubs\Trakt\Token\TraktAccessToken;

function get_token()
{
    return TraktAccessToken::create(
        getenv("TRAKT_ACCESS_TOKEN"),
        getenv("TRAKT_TOKEN_TYPE"),
        getenv("TRAKT_EXPIRES_IN"),
        getenv("TRAKT_REFRESH_TOKEN"),
        getenv("TRAKT_SCOPE")
    );
}

like this:

<?php
//...
$parameters = [Username::set('rolle'), Type::movies()];
$response = History::request($clientId, get_token(), $parameters);

//...
ronilaukkarinen commented 9 years ago

This is crazy... I still get the same error with this:

<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);

require 'vendor/autoload.php';

use Wubs\Trakt\Trakt;
use Wubs\Trakt\ClientId;
use Wubs\Trakt\Request\Parameters\Type;
use Wubs\Trakt\Request\Parameters\Username;
use Wubs\Trakt\Request\Users\History;

// Token from .env
use Wubs\Trakt\Token\TraktAccessToken;

function get_token()
{
return TraktAccessToken::create(
getenv("TRAKT_ACCESS_TOKEN"),
getenv("TRAKT_TOKEN_TYPE"),
getenv("TRAKT_EXPIRES_IN"),
getenv("TRAKT_REFRESH_TOKEN"),
getenv("TRAKT_SCOPE")
);
}

$clientId = ClientId::set(getenv("XXXXX"));
$clientSecret = ClientId::set(getenv("XXXXX"));
$redirectUrl = "";

// $trakt = new Trakt("XXXXX", "XXXXX", "urn:ietf:wg:oauth:2.0:oob");
// // $trakt->authorize();
// $token = $trakt->getAccessToken("XXXXX");

$parameters = [Username::set('rolle'), Type::movies()];
$response = History::request($clientId, get_token(), $parameters);

echo '<pre>';
echo var_dump( $response );
echo '</pre>';

?>

When I dump parameters, I get this:

array(2) {
  [0]=>
  object(Wubs\Trakt\Request\Parameters\Username)#4 (1) {
    ["value":protected]=>
    string(5) "rolle"
  }
  [1]=>
  object(Wubs\Trakt\Request\Parameters\Type)#5 (1) {
    ["value":protected]=>
    string(6) "movies"
  }
}
megawubs commented 9 years ago

Really odd. When I run the code with your name I do get your latest watched movies. The API documentation says the following about error code 403: Forbidden - invalid API key or unapproved app. You can check it here: http://docs.trakt.apiary.io/#introduction/status-codes

ronilaukkarinen commented 9 years ago

Tried with rm -rf vendor && composer install again with no luck...

I had * instead of dev-master in my composer.json and switched that as well, but no change...

{
  "name": "peikko",
  "description": "Peikko.us website",
  "authors": [
    {
      "name": "Roni Laukkarinen",
      "email": "roni@dude.fi"
    }
  ],
  "minimum-stability": "dev",
  "require": {
    "wubs/trakt": "dev-master"
  },
  "require-dev": {
    "phpunit/phpunit": "4.4.*"
  },
  "autoload": {
    "psr-0": {"Wubs": "src/"}
  }
}

Is my composer.json all right? Is your code identical to mine and if not can you link to gist or something... mind-boggling.

megawubs commented 9 years ago

Can you check if you are really sending your client id? And can you check of the application you have created on Trakt is approved?

ronilaukkarinen commented 9 years ago

Yeah, I noticed my .env was in wrong directory... but I got var_dump($token) to show token information, but after a while I got invalid oauth error. Then, when I thought it was right, I got

Fatal error: Uncaught exception 'GuzzleHttp\Exception\ParseException' with message 'Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON' in /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/Message/Response.php:148 Stack trace: #0 /home/rolle/public_html/vendor/wubs/trakt/src/Wubs/Trakt/Response/Handlers/AbstractResponseHandler.php(65): GuzzleHttp\Message\Response->json(Array) #1 /home/rolle/public_html/vendor/wubs/trakt/src/Wubs/Trakt/Response/Handlers/DefaultResponseHandler.php(23): Wubs\Trakt\Response\Handlers\AbstractResponseHandler->getJson(Object(GuzzleHttp\Message\Response)) #2 /home/rolle/public_html/vendor/wubs/trakt/src/Wubs/Trakt/Request/AbstractRequest.php(213): Wubs\Trakt\Response\Handlers\DefaultResponseHandler->handle(Object(GuzzleHttp\Message\Response)) #3 /home/rolle/public_html/vendor/wubs/trakt/src/Wubs/Trakt/Request/AbstractRequest.php(189): Wubs\Trakt\Request\AbstractRequest->handleResponse(Object(GuzzleHttp\Message\Response)) #4 /home/rolle/public_html/vendor/wubs/trakt/src in /home/rolle/public_html/vendor/guzzlehttp/guzzle/src/Message/Response.php on line 148

I'm not exactly sure how to do this, not very familiar with oauths. How to get permanent access token, it seems to expire really fast?

Can you just make some documentation what to do exactly, or paste your full code, or how should we proceed?

My application is "Approved" in the API settings, yes.

I'm patient, I only hope I'm not irritating you too much with this :)

megawubs commented 9 years ago

The request was executed, only the expected JSON result is malformed. Are you capable of creating your own ResponseHandler Object? It's explained in the readme, at the end. Let it return $response->getStatusCode(); ?

ronilaukkarinen commented 9 years ago

Ugh, whenever I add $response line after getting $token, I get "There was an invalid Oauth request from Trakt"... I guess I'm doing the OAUTH thing wrong way. I tried with $trakt->getAccessToken("MY_PIN_HERE") and setting up a false redrect url (I don't have HTTPS) to get ?code= from the URL.