php-如何发送多个xml请求(web服务)

php-如何发送多个xml请求(web服务),php,web-services,Php,Web Services,我没有找到任何关于如何同时(同时)发出多个web服务请求的示例 这是我为了获取酒店详细信息而发出的请求: $s = new soapclient("http://www.wb-service-address.com",array('wsdl')); $HotelInfo = new stdClass; <HotelInfo softwareID="123" SessionId="153" Lang="EN" InfoType=""> <Hotel ID="103"

我没有找到任何关于如何同时(同时)发出多个web服务请求的示例

这是我为了获取酒店详细信息而发出的请求:

$s = new soapclient("http://www.wb-service-address.com",array('wsdl'));
$HotelInfo = new stdClass;

<HotelInfo softwareID="123" SessionId="153" Lang="EN" InfoType="">
     <Hotel  ID="103" /> 
</HotelInfo>

$HotelInfo->xmlRequest = $paramsStr;
$result = $s->__call("SubmitXmlString",array($HotelInfo));
$obj_pros = get_object_vars($result);
$hotel_full_xml =  $obj_pros['SubmitXmlStringResult'];  
$hotel_full_xml = simplexml_load_string($hotel_full_xml);
$s=新的soapclient(“http://www.wb-service-address.com,数组('wsdl');
$HotelInfo=新的stdClass;
$HotelInfo->xmlRequest=$paramsStr;
$result=$s->_调用(“SubmitXmlString”,数组($HotelInfo));
$obj\u pros=get\u object\u vars($result);
$hotel_full_xml=$obj_pros['SubmitXmlStringResult'];
$hotel\u full\u xml=simplexml\u load\u字符串($hotel\u full\u xml);
(XML“HotelInfo”是请求)

我想同时向多个系统(URL)发送相同的请求


我将非常感谢您的帮助

php天生不会这样做,但您可以使用另一个库,如

示例

public function index()
{
 $promises = call_user_func(function () {
     foreach ($this->usernames as $username) {
         (yield $this->client->requestAsync('GET', 'https://api.github.com/users/' . $username));
     }
 });
 // Wait till all the requests are finished.
 \GuzzleHttp\Promise\all($promises)->then(function (array $responses) {
     $this->profiles = array_map(function ($response) {
         return json_decode($response->getBody(), true);
     }, $responses);
 })->wait();
 // Return JSON response
 $response = new Response();
 // StreamInterface objects are not immutable!
 $response->getBody()->write($this->html());
 return $response->withHeader('Content-type', 'text/html');
}

您还可以使用此解决方案:

python的另一个解决方案:


请参见python文档:

您可以查看此帖子的答案:。你可以使用
curl\u multi.*
。允许异步处理多个cURL句柄。@MagnusEriksson-谢谢!但是我没有看到任何关于XML请求的参考…@Jibstroos-谢谢。我读过,但没有看到任何XML请求的例子……您发送的内容与此无关。它仍然只是一个HTTP请求。您不能只使用
SoapClient