This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
FuuuAInfiniteLoop(F.A.I.L)'s profile picture

[solved]Compress with php

Started by FuuuAInfiniteLoop(F.A.I.L), 13 February 2013 - 02:25 AM
FuuuAInfiniteLoop(F.A.I.L) #1
Posted 13 February 2013 - 03:25 AM
anybody know how to compress a string with php so i can use iit in a program?
tesla1889 #2
Posted 13 February 2013 - 03:34 AM
why would you want to compress it?

try this

base64 is probably the fastest
FuuuAInfiniteLoop(F.A.I.L) #3
Posted 13 February 2013 - 03:35 AM
I making a compress program and that would be a function
tesla1889 #4
Posted 13 February 2013 - 03:38 AM
well which compression algorithm do you want?
tesla1889 #5
Posted 13 February 2013 - 03:40 AM
for gz compression, you have options

if you want just the data compressed, use gzcompress

if you want actual gzip file data, use gzencode
FuuuAInfiniteLoop(F.A.I.L) #6
Posted 13 February 2013 - 03:50 AM
and how can i pass my string to php and return the value?

i will use gzencode
PixelToast #7
Posted 13 February 2013 - 03:58 AM
you can use the $_GET table

http.request("http://somesite/derp.php?data="..textutils.urlencode(text).."&mode=compress")
then for php

if ($_GET["mode"]=="compress") {
echo compress_function($_GET["data"]);
} elseif ($_GET["mode"]=="decompress") {
echo decompress_function($_GET["data"]);
}
Cranium #8
Posted 13 February 2013 - 04:00 AM
Just FYI, you don't have to report your post as Solved. You can use the full editor to change the title to include a [Solved] tag.