【发布时间】:2017-12-15 12:32:44
【问题描述】:
我一直在使用 Spotify API。我想对播放列表执行一些操作,这些需要用户登录。我想执行以下网址,以便获得授权持有人:
当我在浏览器 URL 字段中执行此操作时,它可以正常工作并返回一个授权令牌。如果我尝试从 index.php 文件执行此操作,但我遇到了问题。
<?php
$curl = curl_init();
curl_setopt($curl,CURLOPT_URL,$url);
$output = curl_exec($curl);
curl_close($curl);
?>
当我运行该文件时,将出现 spotify 登录页面。但是,在我输入登录详细信息并按 Enter 后,什么也没有发生。
浏览器中的控制台报如下错误:
POST http://localhost:8888/api/login 404(未找到) TypeError:无法在字符串'上创建属性'错误'
<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>
我已将 .htaccess 添加到该文件夹,并在我的 mamps 服务器的 httpd.conf 文件中将 Directory AllowOverride 更改为 All。有多个 AllowOverrides,我不能 100% 确定要更改哪一个。
如果现在还不是很明显,我对此感到很困惑,因此我们将不胜感激任何帮助。
【问题讨论】:
标签: php apache .htaccess oauth spotify