How to authenticate to remote site via HTTP and then submit one more form, accessible only for authenticated user?
What I'm trying to achieve:
- Login to Mantis bug tracker: http://www.mantisbt.org/demo/login_page.php
- Submit new issue: http://www.mantisbt.org/mantis/bug_report_page.php
- Logout: http://www.mantisbt.org/mantis/logout_page.php
I was trying to use Zend_Http_Client
with Curl
adapter but without success.
Any advices?
My code (so far) always returns 200 HTTP code:
$uri = 'http://www.mantis-bt.org/mantis/login.php';
$config = array(
'adapter' => 'Zend_Http_Client_Adapter_Curl',
'curloptions' => array(CURLOPT_FOLLOWLOCATION => true),
);
$client = new Zend_Http_Client($uri, $config);
$client->setMethod(Zend_Http_Client::POST);
$client->setParameterPost('username', 'user');
$client->setParameterPost('password', 'pass');
$r = $client->request();