Reputation: 61
I need send a xml file using curl, but the HEADER of the xml have a tag on Header. see the xml below:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://www.adform.com/api/2010/06"
xmlns:ns1="http://www.adform.com/api/2013/06/18"
xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<soapenv:Header>
<ns:Ticket>Dz02gYmsWnlWF1-hNCVC58jP7QF0idTYi9r9VkjOCIMzpwQ63uZiK4N46NsGs4gX7dryU5nt-FMqRbfs-x2WPg__</ns:Ticket>
</soapenv:Header>
<soapenv:Body>
<ns1:CreateReportScheduleData>
<ns1:ReportSchedule>
<ns1:TemplateId>42734</ns1:TemplateId>
<ns1:Name>ReportScheduleName</ns1:Name>
<ns1:StartDate>2013-06-18T00:00:00</ns1:StartDate>
<ns1:EndDate>2013-06-22T00:00:00</ns1:EndDate>
<ns1:FileDelivery xsi:type="ns1:FileDeliveryToFtp" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns1:FtpAddress>ftp://ftp.mycompany.com</ns1:FtpAddress>
<ns1:UserName>username</ns1:UserName>
<ns1:NotificationEmail>[email protected]</ns1:NotificationEmail>
<ns1:Password>password</ns1:Password>
</ns1:FileDelivery>
<ns1:Frequency>Weekly</ns1:Frequency>
<ns1:WeekDays>
<ns1:WeekDay>Monday</ns1:WeekDay>
<ns1:WeekDay>Wednesday</ns1:WeekDay>
</ns1:WeekDays>
<ns1:FileFormat>Csv</ns1:FileFormat>
<ns1:DataFilters>
<ns1:ReportPresetInterval>Custom</ns1:ReportPresetInterval>
<ns1:ReportInterval>
<ns1:StartDate>2013-06-04T00:00:00</ns1:StartDate>
<ns1:EndDate>2013-06-16T00:00:00</ns1:EndDate>
</ns1:ReportInterval>
<ns1:AdvertiserIds>
<arr:int>2544</arr:int>
</ns1:AdvertiserIds>
<ns1:CampaignIds>
<arr:int>22742</arr:int>
</ns1:CampaignIds>
<ns1:MediaIds>
<arr:int>65335</arr:int>
<arr:int>65337</arr:int>
</ns1:MediaIds>
<ns1:TrackingPointFilterId>18077</ns1:TrackingPointFilterId>
</ns1:DataFilters>
</ns1:ReportSchedule>
</ns1:CreateReportScheduleData>
</soapenv:Body>
</soapenv:Envelope>
This is an example of the soap request, anyone have some ideia how i can set the Ticket tag with CURL?
Thanks a lot!
Upvotes: 0
Views: 287
Reputation: 11942
You could use a regular expression, or :
<?php
$xml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/.........';
list($part1, $part2) = explode("<ns:Ticket>", $xml);
list($ticket, $part3) = explode("</ns:Ticket>", $part2);
$newTicket = "<ns:Ticket>blablabla</ns:Ticket>"; // <== your ticket here
$xml = $part1 . $newTicket . $part3;
echo $xml;
?>
Upvotes: 1