I have a simple curl call that retrieves HTML page from the server, then preg_replace()
that inserts something in the page and then the result of that is echoed back to the browser.
What I noticed is that if HTTP server that curl is trying to get HTML page from, uses header 'Transfer-Enoding: chunked
', html output will be somehow encoded(I noticed a few strange signs) and preg_replace()
call will do the job but the browser will just get ERR_INVALID_CHUNKED_ENCODING
and won't load the page. There must be a way to replace part of the page without messing up chunked encoding ?