代码之家  ›  专栏  ›  技术社区  ›  UnkwnTech

使用XML-RPC向OpenX发送日期

  •  2
  • UnkwnTech  · 技术社区  · 14 年前

    $campaign = new XML_RPC_Value(
                        array('advertiserId' => new XML_RPC_Value($advertiserID, 'int'),
                                'campaignName' => new XML_RPC_Value('My Banner', 'string'),
                                'startDate' => new XML_RPC_Value(new Date(time()), 'DateTime'),
                                'endDate' => new XML_RPC_Value(new Date(time() + (3600*24*3), 'DateTime')/*3 days into the future*/,
                                'impressions' => new XML_RPC_Value(10000, 'int'),
                                'clicks' => new XML_RPC_Value(-1, 'int'),
                                'priority' => new XML_RPC_Value(1, 'int'),
                                'weight' => new XML_RPC_Value(0, 'int')
                        ), 
                        'struct');
    

    OpenX接受日期需要采用什么格式?

    2 回复  |  直到 14 年前
        1
  •  2
  •   Walter Mundt    14 年前

    编辑:查看 http://pear.php.net/package/XML_RPC

    试着这样做:

    $campaign = new XML_RPC_Value(
                    array('advertiserId' => new XML_RPC_Value($advertiserID, 'int'),
                            'campaignName' => new XML_RPC_Value('My Banner', 'string'),
                            'startDate' => new XML_RPC_Value(date('c'), 'dateTime.iso8601'),
                            'endDate' => new XML_RPC_Value(date('c', time() + (3600*24*3)), 'dateTime.iso8601')/*3 days into the future*/,
                            'impressions' => new XML_RPC_Value(10000, 'int'),
                            'clicks' => new XML_RPC_Value(-1, 'int'),
                            'priority' => new XML_RPC_Value(1, 'int'),
                            'weight' => new XML_RPC_Value(0, 'int')
                    ), 
                    'struct');
    

    (XML-RPC日期类型为'日期时间.iso8601,而不是“DateTime”。)

        2
  •  0
  •   Bactos    14 年前

    你读过这个吗? Changing date format