first of all, let me thank you for this awesome component - a must have for every VM user!
![Wink ;)](./images/smilies/icon_e_wink.gif)
We've been building a shop which uses OPC for a few moths now.
As we're getting more and more order, we're looking for a way to capture every info on each order and pass it to Interspire Email Marketer. The reason why every info needs to be captured is that we're planning on offering various deals to customers who ie.: made the payment through PayPal, or ordered above a certain amount - Interspire will help us automatize this.
I've been thinking over and over how to achieve this and my best guess that the API call should be placed within the email_receipt function, so when a confirmed order comes in, the data that will be sent out as the receipt could be passed along with curl to Interspire.
Let me paste the sample code for this API call i need to make:
- Code: Select all
<?php
$xml = '<xmlrequest>
<username>admin</username>
<usertoken>d467e49b221137215ebdab1ea4e046746de7d0ea</usertoken>
<requesttype>subscribers</requesttype>
<requestmethod>AddSubscriberToList</requestmethod>
<details>
<emailaddress>email@domain.com</emailaddress>
<mailinglist>1</mailinglist>
<format>html</format>
<confirmed>yes</confirmed>
<customfields>
<item>
<fieldid>1</fieldid>
<value>John Smith</value>
</item>
</customfields>
</details>
</xmlrequest>
';
$ch = curl_init('http://www.yourdomain.com/IEM/xml.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = @curl_exec($ch);
if($result === false) {
echo "Error performing request";
}
else {
$xml_doc = simplexml_load_string($result);
echo 'Status is ', $xml_doc->status, '<br/>';
if ($xml_doc->status == 'SUCCESS') {
echo 'Data is ', $xml_doc->data, '<br/>';
} else {
echo 'Error is ', $xml_doc->errormessage, '<br/>';
}
}
?>
Can you please help me out with this or guide me through the light?
![Smile :)](./images/smilies/icon_e_smile.gif)
Thank you very much in advance,
Matt (the tech guy)