Is any possible way for JSON support in PHP 5.1.6...? The JSON feature was very useful in ajax call. Is any other ways available instead of JSON support in AJAX...? Can anybody tell me?
As xdazz said, you really should update your PHP to plug security holes, but as a quick fix you can download the PEAR module and just include in your file.
http://download.pear.php.net/package/Services_JSON-1.0.3.tgz from this page: http://pear.php.net/package/Services_JSON/download
Related
I found this blog post and would like to experiment with it more.. The issue is my environment is PHP and not Java. I've looked for how I can translate the code examples I would like to use into PHP but it doesn't look like there is much documentation on PHP and Bitmaps. Any help would be awesome!
Thanks!
http://blog.getspool.com/2011/11/29/fast-easy-realtime-metrics-using-redis-bitmaps/
Actually, you do not really need to handle the bitmaps in the PHP code, provided you use a recent Redis version (2.6), and a compliant PHP client library.
See the following Redis commands:
http://redis.io/commands/bitop
http://redis.io/commands/bitcount
So you can count the bits directly in Redis rather than doing it in PHP.
I have been scouring the internet trying to figure this one out. Any ideas would help. I'm trying to take an .xfdl file (base64gzip of XML) from my server and convert it to .xml with PHP for viewing and modification but, I can't see to figure out this process. I've seen people try to with Ruby but, I don't know any Ruby. If no one can help, I guess I'll be learning Ruby hahaha! Thanks in advanced. Also, I have looked through this website and couldn't find any php examples of this.
Assuming the XML is gzipped first and then base64 encoded, you can use base64_decode() and gzdecode().
echo gzdecode(base64_decode(file_get_contents('file.xfdl')));
However if you're not running on a Windows box, you will need to compile PHP with --with-zlib to include the zlib library and functions.
Once you have it in XML form, you might want to look at XMLReader to see how you can modify and read XML in PHP.
Recently I'm programming a website and I want to prevent my source code from being seen.
I tried famous Guards like Zend or ionCube but I understood that Encoded Code can be decoded easily.
Now I want to develop an Extension to Decode the code at runtime.
I have a Problem.
When the extension runs and the code processes how to return the code to php to be processed?
You want to write an extension. You will need to know C.
Refer to: http://devzone.zend.com/article/1021 and http://www.php.net/manual/en/internals2.php
Is there any PHP library for handling exceptions/errors(including fatal) in PHP? It should be very configurable, support log to file, send Emails, and have integration with different browsers console.
the best library I found is Lagger - support FirePHP extension for Firefox and has own extension for Google Chrome console
including fatal
So after PHP has crashed trying to untangle the source code, you want to run more PHP code to identify where it went wrong? This is not possible with PHP code.
I've used ErrorHandler in the past but Whoops is way better. Amazing!
http://filp.github.io/whoops/
http://filp.github.io/whoops/demo/
Im building a codeigniter app which uses json_encode to provide ajax data in many places... today I learned that the server has php 5.1.6 which doesnt support this method (or json_decode).. what can I do?? please help.
There is an emulation of json_encode() in upgradephp. Just include() that script, and you don't need to rewrite anything.
As alternative you can use PEAR::PHP_Compat. IIRC it has an emulation of that too.
(There are further alternative implementation floating around; but often object-style and not as fast and designed to emulate the core function.)
You can set them up with auto_prepend_file= even. If you just want the JSON extension enabled, there are other sources of course.
You could use Services_JSON if CodeIgniter can use it instead of PHP 5.2's json_* functions - I know Zend_Framework has Zend_Json which uses json_* functions if available, otherwise it uses its own implementation in userland PHP code as a fallback.
Of course, if you have access to the server to compile PHP, you could try the extension or upgrading to PHP 5.2 (a better solution).
EDIT: I would take the route of compatibility layers as mentioned above.
The json_decode is added since (PHP 5 >= 5.2.0, PECL json >= 1.2.0), it is supported in your version too, you should give it a try :)
I needed json_encode and json_decode for jquery grid.
I tried upgradephp but json_encode didnt seem to work with jquery grid so I deleted that function from the file and added this one. json_decode seems to work just fine though.
In fact, 5.1.6 supports json_decode and json_encode, but they can be a bit weird. As in, if you feed it invalid JSON, such as if you have a blank key, it will die without any warnings or errors. But I use json_encode and json_decode every day in a 5.1.6 environment. It's totally possible.