As you have come to this page, I don’t think I need to explain you what Simple HTML DOM parser is. I will come straight to the point.
If you are scrapping data and new line characters such as \n and \r are getting stripped then I have a solution for you.
Inorder to preserve the newline characters you need to do a simple find and replace in simple_html_dom.php file.
I’m using version 1.5 and there are 5 occurences of the text I’m providing.
Find this :
Replace with :
That should solve the problem.
If you want to revert the changes you just need to find the text $stripRN=false and replace with $stripRN=true.
This problem is caused since the variable which defines whether to strip new lines or not is set to true by default, in Simple HTML DOM parser for PHP. Just set it to false and tada! Problem solved. Happy scrapping and happy parsing.