hi again,
I'm a php newbie - and am having a problem with the code below.
Basically it's timing out or cutting the request off before it gets a response back from the remote server (which can take up to 10 seconds). I'd also like to write the server response to the screen - can anyone point me in the right direction?
The code is:
<?php
$fp = fsockopen ("192.168.1.24",6100,$errno, $errstr);
if (!$fp)
{
print "Unable to Connect";
}
fputs($fp,"-mc6 -tr0 -ds1\"MAIL\" -rfC -x"); //send data
$ready = fgets($fp, 3);
for ($elapsed = 0; $elapsed < 256; $elapsed++)
{
$script_result = 5;
$tcp_response = fgets($fp,1);
$z = strpos($in_data, "-x");
if ($z != 0) // -x found
{
$elapsed = 256;
$in_data = sprintf("%s%s",$in_data,$tcp_response);
fputs($fp,"ACK\n");
}
else
{
$in_data = sprintf("%s%s",$in_data,$tcp_response);
}
}
fclose($fp);
?>
I'm a php newbie - and am having a problem with the code below.
Basically it's timing out or cutting the request off before it gets a response back from the remote server (which can take up to 10 seconds). I'd also like to write the server response to the screen - can anyone point me in the right direction?
The code is:
<?php
$fp = fsockopen ("192.168.1.24",6100,$errno, $errstr);
if (!$fp)
{
print "Unable to Connect";
}
fputs($fp,"-mc6 -tr0 -ds1\"MAIL\" -rfC -x"); //send data
$ready = fgets($fp, 3);
for ($elapsed = 0; $elapsed < 256; $elapsed++)
{
$script_result = 5;
$tcp_response = fgets($fp,1);
$z = strpos($in_data, "-x");
if ($z != 0) // -x found
{
$elapsed = 256;
$in_data = sprintf("%s%s",$in_data,$tcp_response);
fputs($fp,"ACK\n");
}
else
{
$in_data = sprintf("%s%s",$in_data,$tcp_response);
}
}
fclose($fp);
?>