本文介绍了Plesk API中的异常HTTP标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

*提供以下cURL函数。

The documentation for the Plesk API* gives the following cURL function.

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;
}

我有几个问题。


  1. 我从来没有在其他任何地方看到带有下划线的HTTP标头。这是文档中的错误吗?

  1. I have never, anywhere else, seen HTTP headers with underscores in them. Is this an error in the documentation?

地球上的是 HTTP_PRETTY_PRINT ?搜索这只是让我回到Plesk文档。

What on Earth is HTTP_PRETTY_PRINT? Searching for this just brings me back to Plesk documentation. I can't see it anywhere else.

使用 HTTP_AUTH_LOGIN HTTP_AUTH_PASSWD 而不是 CURLOPT_USERPWD

顺便提一下,无论我尝试什么选项,我都会从Plesk获得以下响应。

Incidentally, whatever options I try, I'm getting the following response from Plesk.

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协议开发指南>客户端代码示例> PHP客户端应用程序

* Parallels Plesk Panel 9.5:: API RPC Protocol Developer Guide > Client Code Samples > PHP Client Application

推荐答案

对于第4点:

404意味着文件 ... / enterprise / control / agent.php 已从服务器中删除。许多人在几个月前做这件事,以在补丁发货前防止安全漏洞。我建议检查 / usr / local / psa / admin / logs / httpsd_access_log 文件中的错误以及 / usr / local / psa / admin / htdocs / enterprise / control / agent.php

404 would mean the file .../enterprise/control/agent.php has been removed from the server. Many were doing it few months ago to protect from security vulnerability before the patch has been shipped. I would recommend to check /usr/local/psa/admin/logs/httpsd_access_log file for errors and also availability of /usr/local/psa/admin/htdocs/enterprise/control/agent.php

这篇关于Plesk API中的异常HTTP标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 07:39