I am trying to communicate with an API of a vendors of ours. They provide a
Perl example that works fast and well. I am trying to do the same thing with
a PHP class. The response takes over a minute before the response comes
back. I see from the response text that the API is running on Apache
Coyote/1.0. Does anyone know of issues with this match-up, here is the
snippet of code that seems to be hanging. Using my Komodo debugger, it
points to the line with 'while($data=fread($fp, 32768))' while waiting for
execution to continue. Using a Perl script provided by them, I get a
response in seconds. Basically, my PHP page prepares content and variables
and then uses this class to send XML formatted content to receive a
response.
...
$fp=fsockopen($this->server, $this->port, &$this->errno,
&$this->errstr, $this->timeout);
if(!$fp) {
$this->errstr="Cant Connect to Service ($this->server:$this->port,
$this->errno, $this->errstr)";
return;
}
if (!fputs($fp, $op, strlen($op))) {
$this->errstr="Write error";
return;
} else {
$ipd = "";
while($data=fread($fp, 32768)) {
$ipd.=$data;
}
$this->responsetext = $ipd;
//echo "<p>".$ipd."</p>";
$ipd = $this->_parse_header($ipd);
}
fclose($fp);
return $ipd;
...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php