I'm running the following code:
<?php
$i=0;
// connection credentials and settings
$location = 'https://url.com/';
$wsdl = $location.'?wsdl';
$username = 'user';
$password = 'pass';
// create client resource - connection
$client = new Client($location, $wsdl, $username, $password);
// do 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 to change this to run multiple connections, possibly in parallel, although I am not familiar enough with SOAP to understand how to go about this.
ie: While it's running $client-‐>doStuff(); in the loop, I'd like it to run another resource / connection of the next iteration before the other finishes.
Any ideas? Thank you