jwilsson / spotify-web-api-php

A PHP wrapper for Spotify's Web API.
MIT License
866 stars 156 forks source link

Uncaught exception 'SpotifyWebAPI\SpotifyWebAPIException' #32

Closed BillyCallahan closed 9 years ago

BillyCallahan commented 9 years ago

Hello,

I think I'm having the same issue that https://github.com/jwilsson/spotify-web-api-php/issues/29. Here's my error: 1430432140-spotify-error.png - envoi d'image avec NoelShack

So, when I launch index.php it asks me the authorization and when I say 'yes' I'm getting this. I have an another page callback.php which is called once the user clicks on 'yes'. These two pages only contain the code provided by you. I tried to run it on both Linux and Windows :)

If you need anything, ask me ! Thanks in advance, it's really important for me to solve this problem :+1:

Audric.

jwilsson commented 9 years ago

Some code is appreciated :)

BillyCallahan commented 9 years ago

Here it is :) https://github.com/AudricManaud/SpotifyAPI

jwilsson commented 9 years ago

Thanks!

I think your problem lies in a mismatch between the callback URI you've registered at Spotify and the one you're actually using.

In the screenshot, the URL seems to be http://localhost/promus/callback.php but in the code you posted, the redirect URI is http://localhost/callback.php. Try changing one of them, either the registered URI at Spotify or move the files so they're placed where Spotify expects them.

BillyCallahan commented 9 years ago

Owwh I'm sorry that's a previous screenshot, I corrected it and it's still doesn't work: 1430477107-spotify-error.png - envoi d'image avec NoelShack

jwilsson commented 9 years ago

Alright, I've tried reproducing it but I can't find anything wrong with it.

Could you dump the whole response by adding something like

print_r($response);

on line 126 of Request.php, right after the line

curl_close($ch);

and post the result here.

BillyCallahan commented 9 years ago

Weird, it doesn't display anything at all... 1430490339-spotify.png - envoi d'image avec NoelShack

1430490757-sublime-text.png - envoi d'image avec NoelShack

jwilsson commented 9 years ago

Hmm, try with

var_dump(curl_error($ch));

instead. But put it before the

curl_close($ch);

line.

BillyCallahan commented 9 years ago

There it is: 1430490663-spotify-error.png - envoi d'image avec NoelShack

1430490663-sublime-text.png - envoi d'image avec NoelShack

I got teamviewer if you want too :)

jwilsson commented 9 years ago

Great, thanks!

At least we found the problem, cURL needs a local bundle of root certificates. Take a look at this answer: https://laracasts.com/discuss/channels/general-discussion/curl-error-60-ssl-certificate-problem-unable-to-get-local-issuer-certificate/replies/37017 and restart your local server and it should work.

I hope to get a better fix for this into the library.

BillyCallahan commented 9 years ago

Oh my god, it works thank you very much ! You've been so helpful to me :+1: If you need to run some tests on my computer to solve it for everyone, just contact me :)

Audric.

jwilsson commented 9 years ago

Awesome!

Glad we figured it out :)

rubenvdb commented 9 years ago

Seemed to be solved at first, but now stopped working again.

jwilsson commented 9 years ago

@rubenvdb Could you pull down the 0.9.0 branch, test with that code and then open a new issue with the error received.

Thanks!