Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "NON FUNZIONA UN CAZZO";
- if (empty($_GET)) {
- die("This is a redirect URI, go away!");
- } else {
- $code = $_GET['code'];
- echo $code."\n\n";
- $url = 'https://accounts.spotify.com/api/token';
- $data = array('grant_type' => 'authorization_code', 'code' => $code, 'redirect_uri' => 'http://toastify.altervista.org/notify/redirect_uri.php');
- $ch = curl_init($url);
- //set the url, number of POST vars, POST data
- $headers = array(
- 'Content-Type:application/x-www-form-urlencoded',
- 'Authorization: Basic '. base64_encode("cosemagice:woww")
- );
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
- //So that curl_exec returns the contents of the cURL; rather than echoing it
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- //execute post
- $result = curl_exec($ch);
- var_dump($result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement