I'm getting in trouble where I was coding for connection using OpenX API with XML-RPC2. I get the problem that the data type is required by the fire function is the dateTime.iso8601.
This is my code:
$sdatetime = new DateTime('2013-01-01 00:00:00');
$edatetime = new DateTime('2013-06-01 00:00:00');
$startDate = $sdatetime->format(DateTime::ISO8601);
$endDate = $edatetime->format(DateTime::ISO8601);
try {
$result = $aClient->agencyPublisherStatistics($sessionId, 1, $startDate, $endDate);
print_r($result);
} catch (XML_RPC2_FaultException $e) {
die('Exception #' . $e->getFaultCode() . ' : ' . $e->getFaultString());
}
This is result error, when I run script above:
Exception #3 : Incorrect parameters passed to method: Wanted dateTime.iso8601, got string at param 3
If I run print_r(gettype($startDate));
I get the type data is string not date.
My question, for variables $startDate
and $endDate
how to make their data type to be dateTime.iso8601
or date
rather than string
.
Thanks.
it looks like your agencyPublisherStatistics requires specific XML_RPC2_Value date object. You cancreate this by using.
$startDate = XML_RPC2_Value::createFromNative($startDate, ‘datetime’);
same for the end date.. let me know if this works..