Hello, it seems that I have hit a snag.
I'm trying to create a new filter and get it's ID from the response
headers, but I don't know how to do it.
Here's the code that I'm using:
# CREATE A FILTER
$ch = curl_init();
$headers = array(
'Accept: application/xml', # any data returned should be XML
'Content-Type: application/xml'# any data we send will be XML
);
$xml = '
<filter>
<name>'.$email.' Filter</name>
<blocks>
<block>
<field_name>email_address</field_name>
<rules>
<rule>
<operator>==</operator>
<value>'.$email.'</value>
</rule>
</rules>
</block>
</blocks>
</filter>
';
curl_setopt($ch, CURLOPT_USERPWD,
"kWThJuZvCnpC:cm6gzjDIcaho20ja");
curl_setopt($ch, CURLOPT_URL, "
https://app.streamsend.com/
audiences/1/
filters.xml");
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
print_r($response);
echo "<br>";
# get the HTTP status code for our session
$http_status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
# return all options into an associative array
$info = curl_getinfo($ch);
# get the HTTP status code for our session
print_r( $info);
But none of it contains the Filter ID, which should be in the response
Location header, as per documentation:
http://app.streamsend.com/docs/api/classes/FiltersController.html#M00...