php - Parallel, multiple SOAP requests/connections? -
i'm running following code:
<?php $i=0; // connection credentials , settings $location = 'https://url.com/'; $wsdl = $location.'?wsdl'; $username = 'user'; $password = 'pass'; // create client resource - connection $client = new client($location, $wsdl, $username, $password); // stuff while($i<10) { $client-‐>dostuff(); echo $client‐>response(); $i++; } ?>
separately:
<?php public function dostuff() { $this->response = $this->srv()->dostuff(array('stuff' => $this->get('stuff'))); return $this; } public function __construct($location, $wsdl, $username, $password, $proxyhost = null, $proxyport = null) { if(is_null($proxyhost) || is_null($proxyport)) $connection = new soapclient($wsdl, array('login' => $username, 'password' => $password)); else $connection = new soapclient($wsdl, array('login' => $username, 'password' => $password, 'proxy_host' => $proxyhost, 'proxy_port' => $proxyport)); $connection->__setlocation($location); $this->connection = $connection; return $this->connection; } public function srv() { return $this->connection; } ?>
i wanted change run multiple connections, possibly in parallel, although not familiar enough soap understand how go this.
ie: while it's running $client-‐>dostuff(); in loop, i'd run resource / connection of next iteration before other finishes.
any ideas? thank you
as php functional language script waits until $client-‐>dostuff();
finished each time in while loop.
Comments
Post a Comment