I am trying to send data to a Google Analytics collector using Zend_Http_Client and POST. I have an array of $postParams that includes my tracking identifiers, cid and hit and add the values โโof this array to my client using setParameterPost() .
Here is the relevant part of my action:
$client = new Zend_Http_Client('https://ssl.google-analytics.com/debug/collect'); foreach ($postParams as $postParam => $postValue) { $client->setParameterPost($postParam, $postValue); } $response = $client->request();
When calling this script, the following error appears:
Unable to process content type '' automatically. To send such content, use Zend_Http_Client :: setRawData.
It has been added to the _prepareBody() method in Zend_Http_Client. When I add echo($this->enctype); die(); echo($this->enctype); die(); I get NULL .
I would add $client->setEncType(); to my code, but the data is simple.
Does anyone know what I'm missing here? Do I really have to use setRawData ?
Thanks in advance!
Update: $client->setParameterPost('postParams', $postParams); will not work either. It gives the same error.
source share