简体   繁体   English

file_get_contents身份验证给出“ 401访问被拒绝错误”

[英]file_get_contents authentication gives '401 Access Denied Error'

I am trying to create a database in cpanel using the folowing comment 我正在尝试使用以下注释在cpanel创建数据库

$result =file_get_contents("http://$cpanel_user:$cpanel_password@$cpanel_host:2082/frontend/$cpanel_skin/sql/adddb.html?db=$db_name")

echo $result; 回声$结果;

this command gives me HTTP request failed! HTTP/1.1 401 Access Denied 此命令给我HTTP request failed! HTTP/1.1 401 Access Denied HTTP request failed! HTTP/1.1 401 Access Denied error. HTTP request failed! HTTP/1.1 401 Access Denied错误。 I have used the correct password and username for connecting. 我使用了正确的密码和用户名进行连接。 And i am able to create the database when i give this url(url in this format) in a browsers url field . 当我在浏览器的url字段中提供此url(这种格式的url)时,我就能创建数据库

Can someone explain what seems to be the problem? 有人可以解释似乎是什么问题吗?

That is not the correct way to create databases using cPanel. 这不是使用cPanel创建数据库的正确方法。 I believe you are trying to replicate the form inside cPanel to create databases, which is not correct. 我相信您正在尝试在cPanel中复制表单以创建数据库,这是不正确的。

Also, you will not be able to create databases using your cPanel username and password. 另外,您将无法使用cPanel用户名和密码创建数据库。 I think you should refer to this thread to resolve your issue. 我认为您应该参考此主题来解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM