I run 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 good at SOAP to understand how to do this.
i.e.: when running $ client β doStuff (); in a loop, I would like it to start another resource / connection of the next iteration before another ends.
Any ideas? thank you
source share