views:

16

answers:

0

Hi, when connecting to a web service such as Amazon or Yahoo, I find there is a one or two second delay after the data has been sent and before the service disconnects.

I used to program with Perl and solved this by using a regular expression to match the end of the data, then break out of the loop. For example:

while ($line = <SOCKET>) {
    if ($line =~ /^<\/ItemSearchResponse>/) {
        break;
    }
    print "$line\n";
}

Now I'm using PHP and cURL, so I'm not sure what causes this or what the solution is. Thanks for any replies!