How can I send a custom header with the ZEND_HTTP_CLIENT
. I am trying to send a variable key
with a certain value, that I will check later for authenticity
I've tried this
$client = new Zend_Http_Client('http://localhost/v3/files/');
$client->setHeaders('Content-type','multipart/form-data');
$client->setHeaders('key','XXXxXXXXXXXXXXXXXX');
$client->setParameterPost('document_id', $id);
$client->setParameterPost('type_id', $docType['type']);
$client->setParameterPost('file', $form->file);
$response = $client->request(Zend_Http_Client::POST);
and this
$client = new Zend_Http_Client('http://localhost/v3/files/');
$client->setHeaders(array(
'Content-type','multipart/form-data',
'key','XXXxXXXXXXXXXXXXXX'));
$client->setParameterPost('document_id', $id);
$client->setParameterPost('type_id', $docType['type']);
$client->setParameterPost('file', $form->file);
$response = $client->request(Zend_Http_Client::POST);
but it doesnt seem to work. It says key
is not a valid type.
I want to send a custom header like this (similar to what happens when you set headers with the Postman client).
Is this possible?
Try with add a config param like this:
$client = new Zend_Http_Client('http://localhost/v3/files/', array('strict' => false));