я отправляю xml с моего javascript на php-сервер,
javascript отправить это на php
------WebKitFormBoundaryFfB4YR7FJLBRkPEY
Content-Disposition: form-data; name="file"; filename="prova_Fld.xml"
Content-Type: text/xml
<Node>
<NodeId>001</NodeId>
<HwVers>1</HwVers>
<FwVers>1</FwVers>
<MacAdrs>[00:0d:6f:00:01:8d:18:29]!</MacAdrs>
<Notes>prova</Notes>
<Device>
<Address>01</Address>
<Name>dev1</Name>
<Function>prova device</Function>
<Register>
<Address>0100</Address>
<Name>register1</Name>
<Type>R</Type>
<Direction>R</Direction>
<Units>gradi</Units>
<OfsValue>555</OfsValue>
<ScaleFact>555</ScaleFact>
<BitIgnore>02</BitIgnore>
<SamplRate>03</SamplRate>
<Delay>03</Delay>
<MaxLatency>02</MaxLatency>
</Register>
<Register>
<Address>0100</Address>
<Name>register2</Name>
<Type>B</Type>
<Direction>I</Direction>
<Units>t</Units>
<OfsValue>5555</OfsValue>
<ScaleFact>5555</ScaleFact>
<BitIgnore>02</BitIgnore>
<SamplRate>04</SamplRate>
<Delay>44</Delay>
<MaxLatency>04</MaxLatency>
</Register>
</Device>
<Device>
<Address>02</Address>
<Name>dev2</Name>
<Function>device 2</Function>
<Register>
<Address>0200</Address>
<Name>register5</Name>
<Type>B</Type>
<Direction>B</Direction>
<Mask>5555</Mask>
<OfsValue>0</OfsValue>
<ScaleFact>0</ScaleFact>
<BitIgnore>00</BitIgnore>
<SamplRate>03</SamplRate>
<Delay>03</Delay>
<MaxLatency>03</MaxLatency>
</Register>
</Device>
</Node>
</ModbusConfigurator>
------WebKitFormBoundaryFfB4YR7FJLBRkPEY--
автоматически добавляя эти строки в мой xml
------WebKitFormBoundaryFfB4YR7FJLBRkPEY
Content-Disposition: form-data; name="file"; filename="prova_Fld.xml"
Content-Type: text/xml
и в конце файла
------WebKitFormBoundaryFfB4YR7FJLBRkPEY
как я могу удалить его? Я должен изменить любой параметр из javascript или мне нужно удалить то, что мне не нужно от php?
эта работа кода
<?php
header('Access-Control-Allow-Origin: *');
$number=0;
$final="";
$postText = file_get_contents('php://input');
for ($i = 0; $i <=strlen($postText); $i++) {
if($postText[$i]=="<"){
$number=$i;
break;
}else{
$postText[$i]="h";
}
}
for ($i = strlen($postText)-1; $i >=0; $i--) {
if($postText[$i]==">"){
$number2=$i;
break;
}else{
$postText[$i]="f";
}
}
for ($i = 0; $i <=strlen($postText)-$number; $i++) {
$postText[$i]=$postText[$i+$number];
}
for ($i = strlen($postText)-$number; $i<strlen($postText); $i++) {
$postText[$i]="f";
}
$try=substr($postText, 0, strlen($postText)-$number-47);