Put URL and garbage in result from PHP

Mark Schonewille m.schonewille at economy-x-talk.com
Mon Oct 8 09:58:45 CDT 2012


Hi,

I'm downloading a list of words of 9 characters from a MySQL database using a PHP script and a put URL command in a LiveCode script. Altogether, there are approximately 10000 lines in my list, with one word on each line.

Both the PHP script and the LiveCode script run on Mac OS X. I use a put URL command in my LiveCode script, such as

put url "http://localhost/~user/list.php"

The relevant part of the PHP script is:

$q="SELECT xword FROM ydatabase";
$r=mysql_query($q);
if (!$r) {
	echo 'An error occurred: '.mysql_error();
}
else {
	while ($row = mysql_fetch_array($r)) {
		echo "$row[0]\n";
	}
}

Exactly every 8001 bytes (or 889 words, which are all different), I get some garbage:

1f41
AAAAAAAAA
AAAAAAAAB
[889 times]
AAAAAAAAC
1f41
AAAAAAAAP
AAAAAAAAQ
[889 times]
AAAAAAAAR
etc etc etc
BBBBBBBBX
1e7d

The garbage is often the same but not always and it appears before the first line and after the last line. I have tried several combinations of the content-type and content-transfer-encoding headers in PHP. I have also tried changing the encoding of the PHP script itself.

If I call the same URL from CURL and pipe the output to a text file or if I open the URL in a browser, I don't see any garbage:

AAAAAAAAA
AAAAAAAAB
[889 times]
AAAAAAAAC
AAAAAAAAP
AAAAAAAAQ
[889 times]
AAAAAAAAR
etc etc etc
BBBBBBBBX

Does anyone have an idea what causes LiveCode to add garbage to my list?

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other colour spaces. http://www.color-converter.com






More information about the use-livecode mailing list