html - PHP returning page error on simplexml print_r -
The problem is only with one file when I try to do a DocumentDOM / SimpleXML method, so it seems That problem does not have any clue with that file what can this be.
If I do the following:
$ file = "test1.html"; $ Dom = DOMDocument :: Load HTML file ($ file); $ Xml = simplexml_import_dom ($ dom); Print_r ($ xml); In Chrome,
, I get a "Page Unavailable" error in Firefox, I do not get anything.
If I do the same thing but for "test2.html", I get printed as expected.
If I try the same thing but by doing so:
$ file = "test1.html"; $ Data = file_get_contents ($ file) $ dom = DOMDocument :: loadHTML ($ data); $ Xml = simplexml_import_dom ($ dom); Print_r ($ xml);
I get the same issue.
If I comment on the print_r line, then Chrome goes to the blank space with "Page unavailable".
I changed the permissions to 777, if it was a problem, there was no fix.
I just tried to resonate the content of html, no problem.
Any clues why A) Chrome will do this, and b) Why am I not getting any useful results?
Update:
If I put it in: $ file = "test1.html"; $ Dom = DOMDocument :: Load HTML file ($ file); If (! $ Dom) {resonant "no load!"; } And {$ xml = simplexml_import_dom ($ dom); Print_r ($ xml); }
I get the same problem if I put it in:
$ file = "test1.html"; $ Dom = DOMDocument :: Load HTML file ($ file); If (! $ Dom) {resonant "no load!"; } And {echo "load!"; }
I get "loaded"! Output, which means that DOM method should not be problem (?)
I will try the same exact test with SimplexM.
Update2:
If I do this:
I get the same issue if I put it in:
$ file = "test1.html"; $ Dom = DOMDocument :: Load HTML file ($ file); $ Xml = simplexml_import_dom ($ dom); If (! $ Xml) {resonant "no load!"; } And {echo "load!"; }
I get "load"! But if I do:
$ file = "test1.html"; $ Dom = DOMDocument :: Load HTML file ($ file); $ Xml = simplexml_import_dom ($ dom); If (! $ Xml) {resonant "no load!"; } And {echo "load!"; Print_r ($ xml); } I get an error: I finally noticed that I had the option of seeing errors in Chrome: error 324 (pure :: ERR_EMPTY_RESPONSE) : unknown error.
The problematic HTML file is 288Kb Can this be the problem? If so, how do I adjust for this?
Last update:
Very strange. I can use the methods and functions of the object (in the form of simplexml or domdocument), so I can do something to remove some methods (small results) or ambush HTML etc. It can remove the result, but for larger stuff (
Therefore, since the end result, I think that these standards will fit, I should be OK (I think).
But any real solution is very welcome.
- Turn on error reporting: < Code> error_reporting (E_ALL); in the first line of your PHP code.
- Check the memory limit for your PHP configuration: in the related php.ini
- test1What is the difference between .html and test2.html? Perhaps test1.html is not well made.
Comments
Post a Comment