* Thus wrote Robert Fitzpatrick ([EMAIL PROTECTED]): > 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))) {
which HTTP version are you requesting? I know that if you send a HTTP/1.1 then a lot of servers send the data in chunks, thus your retrieval code needs to be different. If it is HTTP/1.1 try using HTTP/1.0 instead. > $this->errstr="Write error"; > return; > } else { > > $ipd = ""; > while($data=fread($fp, 32768)) { Have you tried smaller requests mabey 512? although that shouldn't matter, but you might be able to see if it is getting data back at all. > $ipd.=$data; > } HTH, Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php