-
Notifications
You must be signed in to change notification settings - Fork 20
/
testoauth.php
29 lines (21 loc) · 675 Bytes
/
testoauth.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
require 'vendor/autoload.php';
$session = new SpotifyWebAPI\Session('8c988382603f43d982cb679d3c7bfe00', '7ebb55b36eae42199721981d6a60062e', 'https://localhfost:11114/callbadck.php');
$scopes = array(
'playlist-read-private',
'user-read-private'
);
try {
$session->requestCredentialsToken($scopes);
} catch(SpotifyWebAPI\SpotifyWebAPIException $e) {
print 'hi' . $e->getMessage();
}
$authorizeUrl = $session->getAuthorizeUrl(array(
'scope' => $scopes
));
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $authorizeUrl);
$contents = curl_exec ($ch);
echo '<a href="' . $authorizeUrl . '">here</a>';
die();