Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend HTTP Client password

Im trying to connect from PHP(Zend Framework) code to an aspx Web Service. I need to send via post a few parameters to the page( email, password). I have tried to use Zend_Http_Client, and do this:

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

where $username, $password are the username and password I use to log in to the web service(it has a pop-up window that asks me for username and password).

This code gives me the unauthorized page. So im asking where am I using the site username and password wrong? How can I use them?

edit: The Auth is auth-basic.

Edit2:

I talked to the owner of the web service he says that everything is UTF-8 is this a problem, isnt it is a default? If not how do i do that?

like image 796
The GiG Avatar asked Mar 17 '11 18:03

The GiG


1 Answers

You could check if a referer-header is needed, or it might be that it also needs a cross-site request forgery number. Simply dump the request that is made by your browser when you login and dump the request that your script is generating, compare those and it should work out.

For the browser-request dump you could use livehttpheaders plugin for firefox.

like image 193
Garuda Avatar answered Sep 26 '22 01:09

Garuda