У меня был следующий php-скрипт для обновления значения xml:
//The XML string that you want to send.
$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>
<reminder>
<date>2019-20-02T10:45:00</date>
<heading>Meeting</heading>
<body>Team meeting in Boardroom 2A.</body>
</reminder>';
//The URL that you want to send your XML to.
$url = 'http://localhost/xml';
//Initiate cURL
$curl = curl_init($url);
//Set the Content-Type to text/xml.
curl_setopt ($curl, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
//Set CURLOPT_POST to true to send a POST request.
curl_setopt($curl, CURLOPT_POST, true);
//Attach the XML string to the body of our request.
curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);
//Tell cURL that we want the response to be returned as
//a string instead of being dumped to the output.
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
//Execute the POST request and send our XML.
$result = curl_exec($curl);
//Do some basic error checking.
if(curl_errno($curl)){
throw new Exception(curl_error($curl));
}
//Close the cURL handle.
curl_close($curl);
//Print out the response output.
echo $result;
Но я собираюсь сделать так, чтобы $ xml с использованием динамического значения пытался сделать что-то подобное:
$date= $_POST['datevalue'];
$heading= $_POST['meetingvalue'];
$body= $_POST['bodycontent'];
$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>
<reminder>
<date>{$date}</date>
<heading>{$date}</heading>
<body>{$date}</body>
</reminder>';
К сожалению, приведенный выше код не работает, кажется, {$ date} не отправил ничего, чтобы отдохнуть SOAP.
Кто-нибудь имеет опыт, как решить эту проблему,