Hi,
I am trying to write a shell script to parse the post request data that it received to a xml file. Below is the post request data that script is receiving.
-----------------------------7dd2339190c8e
Content-Disposition: form-data; name="param1"
1
-----------------------------7dd2339190c8e
Content-Disposition: form-data; name="param2"
2
-----------------------------7dd2339190c8e
Content-Disposition: form-data; name="param3"
3
-----------------------------7dd2339190c8e
Content-Disposition: form-data; name="param4"
4
-----------------------------7dd2339190c8e
Content-Disposition: form-data; name="xmldata"
<ShapeInfo>
<Rectangles>
<Rectangle>
<top>47</top>
<left>169</left>
<bottom>173</bottom>
<right>343</right>
</Rectangle>
</Rectangles>
<Lines>
<Line>
<startX>349</startX>
<startY>127</startY>
<endX>499</endX>
<endY>274</endY>
</Line>
</Lines>
</ShapeInfo>
-----------------------------7dd2339190c8e--
!/bin/sh
echo "" > "file.xml"
if [ "$REQUEST_METHOD" = "POST" ]; then
if [ "$CONTENT_LENGTH" -gt 0 ]; then
while read -n $CONTENT_LENGTH POST_DATA <&0
do
echo "$POST_DATA" >> "file.xml"
done
fi
fi
How can I parse it and dump it into xml? Any reference?
Thanks,
Jdp