Put URL and garbage in result from PHP

Michael Kann mikekann at yahoo.com
Mon Oct 8 23:30:43 EDT 2012


Mark,

A little more on the "junk" found in your output.

The hex number 1e7d is 7805 in decimal, which is not divisible by 9. If all your words have 9 characters then 1e7d cannot represent the number of bytes left over after groups of 8001 bytes have been outputted. What the final 1e7d represents, if anything, is a mystery (at least to me).

Mike

--- On Mon, 10/8/12, Mark Schonewille <m.schonewille at economy-x-talk.com> wrote:

From: Mark Schonewille <m.schonewille at economy-x-talk.com>
Subject: Put URL and garbage in result from PHP
To: "How to use LiveCode" <use-livecode at lists.runrev.com>
Date: Monday, October 8, 2012, 9:58 AM

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




_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the Use-livecode mailing list