PHP ve SOAP ile eszamanli bağlantıları?

0 Cevap php

Ben SOAP kullanarak ve bunun son derece temellerini anlamak için yeni.

Ben, bir istemci kaynak / bağlantı oluşturmak sonra bir döngüde bazı sorgular çalıştırmak ve ben bittim. Ben döngü yineleme artınca yaşıyorum konudur, yani: 100-1000, bu bellek tükendi gibi görünüyor ve bir iç sunucu hatası düşer.

How could I possibly run either a) multiple simaltaneous connections or b) create a connection, 100 iterations, close connection, create connection.. etc.
"a)" looks to be the better option but I have no clue as to how to get it up and running whilst keeping memory (I assume opening and closing connections) at a minimum.

Şimdiden teşekkürler!

index.php

<?php
// set loops to 0
$loops = 0;

// connection credentials and settings
$location = 'https://theconsole.com/';
$wsdl = $location.'?wsdl';
$username = 'user';
$password = 'pass';

// include the console and client classes
include "class_console.php";
include "class_client.php";

// create a client resource / connection
$client = new Client($location, $wsdl, $username, $password);

while ($loops <= 100)   
    {
    $dostuff;
    }
?>

class_console.php

<?php
class Console {
// the connection resource
private $connection = NULL;

/**
* When this object is instantiated a connection will be made to the console
*/
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;
}

/**
* Will print any type of data to screen, where supported by print_r
*
* @param $var - The data to print to screen
* @return $this->connection - The connection resource
**/
public function screen($var) {
print '<pre>';
print_r($var);
print '</pre>';
return $this->connection;
}

/**
* Returns a server / connection resource
*
* @return $this->connection - The connection resource
*/
public function srv() {
return $this->connection;
}

}
?>

0 Cevap