Problem with fsockopen() and fgetc()

From: Date: Fri, 14 Mar 2003 13:40:20 +0000
Subject: Problem with fsockopen() and fgetc()
Groups: php.general 
Request: Send a blank email to php-general+get-139710@lists.php.net to get a copy of this message
I try to connect to a site via fsockopen function and get data calling a cgi on remote server using a script like this following. The response is a large amount of data up to 500Kb. But every 5000 characters approximately I get arbitrary strings like numbers "1400" and "800" and others like "7be" etc. I don't know what to do to avoid this trouble. Please if someone knows, let help me. Thanks. PHP SCRIPT -------------------- $fp = fsockopen ("ns.ana.gr", 80); fputs ($fp, "GET http://www.xxx.com/cgibin/xxx.exeservice=SPE&format=TXT&time=3&day=11/03/200 3 HTTP/1.1\r\nHost: www.xxx.com\r\nAuthorization: Basic xxxxxxxxxxxxxxxxx==\r\n\r\n"); while (!feof($fp)) { $line = fgetc ($fp); echo $line; } fclose ($fp);

« previous php.general (#139710) next »