Plesk API文档*提供以下cURL函数。
function curlInit($host, $login, $password)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://{$host}:8443/enterprise/control/agent.php");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array("HTTP_AUTH_LOGIN: {$login}",
"HTTP_AUTH_PASSWD: {$password}",
"HTTP_PRETTY_PRINT: TRUE",
"Content-Type: text/xml")
);
return $curl;
}
我有几个问题要问。
HTTP_PRETTY_PRINT
到底是什么?搜索这个只会让我回到Plesk文档。其他地方我看不见。HTTP_AUTH_LOGIN
和HTTP_AUTH_PASSWD
代替CURLOPT_USERPWD
是怎么回事?顺便说一句,不管我尝试了什么选择,我都会从普列斯克那里得到以下回应。
HTTP/1.1 404 Not Found
X-UA-Compatible: IE=EmulateIE7
Content-Type: text/html
Content-Length: 345
Date: Wed, 27 Jun 2012 14:58:15 GMT
Server: sw-cp-server
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>404 - Not Found</title>
</head>
<body>
<h1>404 - Not Found</h1>
</body>
</html>
* Parallels Plesk Panel 9.5::API RPC Protocol Developer Guide > Client Code Sample> PHP Client Application
发布于 2012-07-02 12:30:30
用于第4点:
404将意味着文件.../enterprise/control/agent.php
已从服务器上删除。许多人在几个月前就这样做了,以在补丁发布之前保护安全漏洞。我建议检查/usr/local/psa/admin/logs/httpsd_access_log
文件中的错误和/usr/local/psa/admin/htdocs/enterprise/control/agent.php
的可用性。
发布于 2012-06-28 05:07:57
HTTP_AUTH_LOGIN
头包含面板用户登录名。HTTP_AUTH_PASSWD
头包含面板用户密码。不需要CURLOPT_USERPWD
。https://stackoverflow.com/questions/11228046
复制相似问题