Отпровляю post запрос через сURL xml .Когда указываю параметр curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));или aplication/xml.Запрос вообще не отпровляется на сервер.Если не узать CURLOPT_HTTPHEADER, то xml приходит как массив [<?xml version="1.0" encoding]"UTF-8" ?>
<priceRequest><customerNo>123</customerNo><password>abc</password><skuList><SKU>.
Как отослать xml чтобы на сервере его согли распарсить .
код
$xml_data = '<?xml version="1.0" encoding="UTF-8" ?>
<priceRequest><customerNo>123</customerNo><password>abc</password><skuList><SKU>99999</SKU><lineNumber>1</lineNumber></skuList></priceRequest>';
$URL = "https://test.testserver.com/PriceAvailability";
$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
print_r($output);
$xml_data = '<?xml version="1.0" encoding="UTF-8" ?>
<priceRequest><customerNo>123</customerNo><password>abc</password><skuList><SKU>99999</SKU><lineNumber>1</lineNumber></skuList></priceRequest>';
$URL = "https://test.testserver.com/PriceAvailability";
$headers = array(
"Content-type: text/xml",
"Content-length: " . strlen($xml_data),
"Connection: close",
);
$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
Всем известно, что в telegram можно создавать ботов, которые будут общаться с юзером, показывая ему различные кнопки
Вот, есть такой массив
Всем привет! Я использую библиотеку https://githubcom/beyondcode/laravel-websockets