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.
Related
I have been researching for a few days now, and have found no useful tutorials or guides on how to perform a decode of an ioncube encoded file by using xdebug.. Multiple SO post answers do not serve a starting place for a complete beginner.
In short: You can't.
In long:
IonCube is an encoder, and Xdebug is a debugger - not a decoder. It does not know how to read encoded files and even if it could get into the process of intercepting the PHP things that it does, it still won't be able to show you the source code.
When a file is encoded, it is first converted from text into "opcodes"—that is an internal representation of binary stuff which PHP can execute. At this stage, it is already useless for Xdebug.
And then it is encoded, which makes it even less possible to do anything with.
I've a word (.doc) file in my server, that's location something like(...../mfunction/booklist.doc). so now I'm confused how can i get the text of (.doc) that file in android app's listview. Is it be done via JSON parsing or XML parsing or something others. In which way it will be better to do ? I'm confused about PHP code, how will i manage it? And my idea says it's not like as usual JSON or XML parsing.
I need better explanation and detail,can anyone help me pls by giving any idea or tutorial link about PHP code ?
Check out Antiword if you can install packages on your envoirenment. Using this and shell_exec(), you should be able to retrieve the contents of a word document.
Also read https://stackoverflow.com/a/265079/473475 - it suggests a solution if you aren't able to install Antiword.
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
Good day!
I have a PHP script that reads a very huge XML file. I used fgets to read line by line. In some point, we need to stop the said script to check some data integrity. My problem is how to resume that running state (I mean the line which the script stopped). We don't want to start the script all over again for it takes days to be completed.
Is there such way that I can accomplish this? Any suggestion would be greatly appreciated.
DomDocument ?
There's also SimpleXML library of PHP which needs to be installed before using it in your applications, but before you use any of it's functions, it loads all of the XML document into it's cache.
There's also XMLReader library, which is used to read XML files without loading all of the file to cache, and is the better method for using for situations like this.
Here you can find information about these two libraries :
http://us.php.net/manual/en/book.xmlreader.php
http://us.php.net/manual/en/book.simplexml.php
And examples of using them:
http://us.php.net/manual/en/simplexml.examples-basic.php
And here's much more detailed explanation :
How to use XMLReader in PHP?
i run a job search site, and i need to convert doc, docx and pdf files into HTML on linux CentOS server running php. People submit these files as resumes. So far, I found PHPDocx to be great at converting docx to html. But I am stuck at doc/pdf. PDFTOHTML gives error "bad color" when i run tests. As far as doc, i only found wvwave, which seems complex and bulky to install.
does anyone have any ideas on how to easily convert doc/pdf to HTML?
The only thing i can think of is FPDF.
It is intended for creating PDF files in PHP but it can also open PDF files.
Maybe you can use that as a base and develop some sort of toHTML function for it.
It is completely free to use and it has some extensions already.
It MIGHT help you.
http://www.fpdf.org
EDIT:
Thanks for the addition to my post in the comments to Pierre:
You can use fpdi: http://www.setasign.de/products/pdf-php-solutions/fpdi but the input pdf is just like an image.
I havent taken a look at it myself so far but this might help.
As far as .doc files go how about trying OpenOffice/LibreOffice, something like:
lowriter -convert-to html doc_file.doc –
As far as PDF goes, if the PDF is a graphical representation of text then you're out of luck, best you can do is try convert it to an image with ImageMagick, if it is a proper text it should easily convert.
There are various tools out there already to do this, such as http://dag.wieers.com/home-made/unoconv/, http://www.phpdocx.com/ (which you've already tried)
http://www.phplivedocx.org/2009/08/13/convert-docx-doc-rtf-to-html-in-php/ looks promising.
Or, you could install a portable version of libreoffice on your server which allows command line conversion
https://help.libreoffice.org/Common/Starting_the_Software_With_Parameters
I'm sure there'll be tutorials out there (on libreoffice support area)
To easily convert pdf to html, I would suggest pdf2htmlEX which produces outstanding HTML and is fast enough for runtime converting. You should first put some effort to optimize and build it for your system. There is simple build howto included on the project link.