I am inserting data in MySQL with CKeditor and PHP. I am taking raw HTML from the user side. If the user leaves some quotes or tags open then how could I handle this problem?
For example, if users inputs in source of ckeditor and leaves quotes open, then how to solve this in PHP?
<p style="color:red;> Some Content </p>
And the HTML string is save in $postObj->post_content
.
I am getting this error:
Warning: DOMDocument::loadHTML() expects parameter 2 to be long, string given on line 55 and here is my code ... libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->loadHtml($postObj->post_content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $cont = $dom->saveHTML().PHP_EOL; $res = $common->findFirstPara($cont,$ad_content); libxml_clear_errors();