1

Possible Duplicate:
JavaScript implementation of Gzip

I'm looking for a text (string) compression method that works in JavaScript and PHP, similarly to how it works in JSON. I do not know if there is a similar technology.

For example, I would like to compress text with JavaScript and then decompress it afterwards with PHP in another page.

I apologize in advance if this post seems to be a duplicate, but I have searched and have not found anything similar to what I need. I only found functions that work exclusively in one technology (PHP or JavaScript, not in both. one example:

<script>
var text=aaaaa;
 text=functionForCompress(text){}
 text-> for example 5a
<script>

in a page php:

$decompresedText=functionForDeCompress(request->data);
$decompresedText -> aaaaa

request->data contains variable text of script

Community
  • 1
  • 1
Martin
  • 1,282
  • 1
  • 15
  • 43

1 Answers1

2

For javascript compression first download jsmin-php , you can download it from https://github.com/rgrove/jsmin-php

example php :

<?php
require 'jsmin.php';

$jsmin_php = JSMin::minify(file_get_contents("your_javascript_file.js"));

echo $jsmin_php;
?>
Kamesh S
  • 143
  • 2
  • 8