简体   繁体   English

使用PHP的Zend XML RPC客户端进行HTTP身份验证

[英]HTTP Authentication with PHP's Zend XML RPC Client

I am using the Zend library's XML RPC Client in a PHP application to pull data from another server over XML RPC. 我在PHP应用程序中使用Zend库的XML RPC Client通过XML RPC从另一个服务器提取数据。 However the other server is using HTTP basic authentication. 但是其他服务器正在使用HTTP基本身份验证。 How can I tell the XMLRPC client to use authentication for the requests? 如何告诉XMLRPC客户端对请求使用身份验证?

Zend_XmlRpc_Client internally uses a Zend_Http_Client which handles the basic HTTP communication. Zend_XmlRpc_Client内部使用Zend_Http_Client来处理基本的HTTP通信。 You can retrieve the HTTP client with: 您可以使用以下命令检索HTTP客户端:

$httpClient = $rpcClient->getHttpClient();

and then you can set the requires authentication parameters: 然后您可以设置requires身份验证参数:

$httpClient->setAuth($username, $password, Zend_Http_Client::AUTH_BASIC);

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

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