Oauth Spotify API与PHP

Oauth Spotify API与PHP,php,apache,.htaccess,oauth,spotify,Php,Apache,.htaccess,Oauth,Spotify,我一直在使用SpotifyAPI。我想在播放列表上执行一些操作,这些操作需要用户登录。我想执行以下url,以便获得授权持有人: 当我在浏览器URL字段中执行此操作时,它工作正常并将返回授权令牌。如果我试图从index.php文件执行此操作,则会遇到问题 <?php $curl = curl_init(); curl_setopt($curl,CURLOPT_URL,$url); $output = curl_exec($curl); curl_close($curl); ?>

我一直在使用SpotifyAPI。我想在播放列表上执行一些操作,这些操作需要用户登录。我想执行以下url,以便获得授权持有人:

当我在浏览器URL字段中执行此操作时,它工作正常并将返回授权令牌。如果我试图从index.php文件执行此操作,则会遇到问题

<?php 
$curl = curl_init();
curl_setopt($curl,CURLOPT_URL,$url);
$output = curl_exec($curl);
curl_close($curl);
?>

当我运行该文件时,将显示spotify登录页面。但是,在我输入登录详细信息并按enter键后,什么也没有发生

浏览器中的控制台报告以下错误:

邮政404(未找到) TypeError:无法在字符串“”上创建属性“error”

<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /api/login was not found on this server.</p>
</body></html>

404找不到
找不到
在此服务器上找不到请求的URL/api/登录名

我已将.htaccess添加到该文件夹,并在我的mamps服务器的httpd.conf文件中将目录AllowOverride更改为All。有多个AllowOverrides,我不能100%确定要更改哪一个


如果现在还不清楚的话,我很抱歉在这件事上不知所措,因此非常感谢您的帮助。

您确定该端口上存在关于localhost的页面吗?您在spotify上的开发帐户上是否列出了该页面的白色列表

您也可以尝试jwilsson提供的包,这样您就不必与整个oauth过程抗争