Send xml file in textarea form in PHP

I need to send content of my xml file located on server to text form. I try to use curl method in PHP, but i don't know how to read content from xml file and save it to variable. What's wrong?

Here PHP-code:

if ($model->getSOrderStatuses()->id == 1) {
$xml = new XMLWriter();
$xml->openMemory();
$xml->openURI('uploads/files/orders.xml');
$xml->startDocument('1.0', 'UTF-8');
$xml->startElement("order"); //start root
$xml->writeElement("id", $model->getId());
$xml->writeElement("date", gmdate("Y-m-d\/H:i:s", $model->getDateCreated()));
$xml->writeElement("customer", $model->getUserFullName());
$xml->writeElement("phone", $model->getUserPhone());
$xml->writeElement("email", $model->getUserEmail());
$xml->writeElement("delivery_type", $model->getSDeliveryMethods()->getId());
$xml->writeElement("delivery_adress", $model->getUserDeliverTo());
$xml->writeElement("payment_type", $model->getSPaymentMethods()->getId());
$xml->writeElement("comment", $model->getUserComment());
$xml->startElement("products");  //open element
foreach ($model->getSOrderProductss() as $sOrderProduct) {
$total = $total + $sOrderProduct->getQuantity() * $sOrderProduct->toCurrency();
$product = $sOrderProduct->getSProducts();
$xml->startElement("row");       //open element
$xml->writeAttribute("code", $product->getUrl());
$xml->writeAttribute("qty", $sOrderProduct->getQuantity());
$xml->writeAttribute("price", $sOrderProduct->toCurrency());
$xml->writeAttribute("sum", $sOrderProduct->getQuantity() * $sOrderProduct-    >toCurrency());
$xml->endElement();  //close element
}
$xml->endElement();  //close element
$xml->writeElement("sum", my_money_format('',$total));
$xml->endElement();  //close root
$xml->flush();
$xmlorder = 'uploads/files/orders.xml';
$ch = curl_init('http://pathtomyserver/?action=newor');
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlorder);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_HEADER,0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
echo($xmlorder);
$info=curl_getinfo($ch);  
curl_close($ch);
}
}

form:

>>link

Answers


You could use this

$xml = file_get_contents("path/to/xml.xml");

Then simply output to textarea

<textarea name="xml"><?php echo $xml; ?>

Need Your Help

Installed magento extension Ma2_Manufacturers_Free but it doesn't appear in admin area

magento

I'm installed magento extension successfully but it doesn't appear at admin area. I install via magento connect from this magento developer:

How to draw an image over a tabcontrol using c#?

c# winforms tabcontrol

I have to draw image in a tabcontrol using C#. I got few hints to change DrawMode to OwnerDrawFixed, and SizeMode to Fixed. After that write handler for DrawItem event as: