我试图从PHP(Zend Framework)代码连接到aspx Web服务。我需要通过发送一些参数发送到页面(电子邮件,密码)。我曾尝试使用一个Zend_Http_Client,并做到这一点:Zend HTTP客户端密码
$client = new Zend_Http_Client('https://thesiteurl.asmx/Login');
$client->setMethod(Zend_Http_Client::POST);
$client->setAuth($username, $password);
$client->setParameterPost(array('email' => 'email', 'password' => 'password'));
$response = $client->request();
$this->view->response = $response;
其中$username, $password
是用户名和密码,我用它来登录到Web服务(它有问我的用户名和密码的弹出窗口) 。
此代码给我未经授权的页面。所以即时通讯问我在哪里使用网站的用户名和密码错误?我如何使用它们?
编辑: 验证是auth-basic。
EDIT2:
我跟Web服务的老板,他说,一切都是UTF-8,这是一个问题,不是它是默认?如果不是,我该怎么做?
这应该工作..但你可以尝试将凭据添加到URL:$ client-> setUri('https:// user:[email protected]'); – opHASnoNAME 2011-03-17 18:49:24
试图,没有任何工作 – 2011-03-17 19:11:57
该网站是否使用基本授权或摘要? – akond 2011-03-17 19:23:52