I keep getting this error
[Subscribers.GetUnsubscribedResult] => Array
[code] => 5
[Message] => Invalid date
Whenever I send this to getUnsubscribes API method:
[ApiKey] => 92a40e5bfa0dbe67d14ee2fa8a1efc48bb0b8b54
[ListID] => 276443
[Date] => '2008-02-12 15:11:03'
Whats wrong with my Date? Im using PHP4 with NUSOAP btw.
I have had a look at this and cannot reproduce the error.
If you could provide any more information about it, including the PHP files used, I can look into the issue further.
Just to confirm the only way that an Invalid Date error can be raised is if the date cannot be parsed by .Net environment.
$yesterday = date("Y-m-d H:i:s",strtotime("-1 day")); //yesterday 'YYYY-MM-DD HH:MM:SS' foreach($subscriptions as $api_list_id=>$subscription): /* List Unsubscribes over the past 24hrs */ $params = array('ApiKey' => $cm_api_key, 'ListID' => $api_list_id, 'Date' => "'".$yesterday."'"); print_r($params); $unsubs = $soapclient->call('GetUnsubscribes',$params,'http://app.campaignmonitor.com/api/','http://app.campaignmonitor.com/api/'); //$unsubs = getUnSubUserIds($unsubs);//simplify unsubs output into userid-array print_r($unsubs); /*Unsubscribe per user*/ /*foreach($unsubs as $unsub): $parameters = array($api_key,$unsub['userid'],$subscription); $soapclient2->call('ws_unSubscribeMember',$parameters); endforeach;*/ /* List email-bounces of the list */ $params = array('ApiKey' => $cm_api_key, 'ListID' => $api_list_id, 'Date' => "'".$yesterday."'"); $bounces = $soapclient->call('GetBouncedSubscribers',$params);
This is the code-segment which I used to generate the SOAP requests I sent earlier.Could you give me an example of a .NET friendly Date?
The problem is that you are enclosing the date within ' ' i.e the string that we are receiving is "'2008-02-12 15:11:03'", I should have picked this up earlier sorry just looked over it.
The following example should work: note $yesterday is simply inserted into the $params array
$params = array('ApiKey' => $cm_api_key, 'ListID' => $api_list_id, 'Date' => $yesterday); print_r($params);
We have added error checking for date enclosed within quotes which will go live on the next update