I'm trying to extract data from a HTML file, the other extraction works fine, except for the above, giving lots of issue. I even separated this set of code specifically to one PHP file for processing and same issue.

Any idea? I use jQuery Ajax with multiple functions at home page with

$.ajax({

I'm new to Ajax, it's alright to have multiple Ajax in one page right?

So clearly it is some kind of object. I'm not familiar with the simple_html_dom library, but presumably it's an object that belongs to that library and represents an HTML element. Perhaps it is a native DOMElement object; I don't know.

What is clear, however, is that it is some kind of recursive structure. That is to say, in some sense it contains itself. This is perfectly possible in PHP, but it is impossible to represent in a JSON string. For instance, in PHP:

$foo->self is the same object as $foo. Indeed, you could do $foo->self->self->self and it would work fine. This is a very simple recursive structure. Yours is probably a bit more complex, but not dissimilar in principle. This can't be represented in JSON. json_encode will error when it encounters recursion.

I imagine you probably wanted to store the text content of the title, rather than the title element itself. Briefly reading the API documentation for the library, it seems you want the plaintext property. I'm not quite sure how this works (the APi is, shall we say, sparse) but my guess would be the following: