PHP SimpleHTMLDom issue
Posted on 2013-11-08
This seems to be a strange problem.
I have a class with three methods.
method1 - uses CURL to get the HTML contents of a page, passed the HTML to SimpleHTMLDom and stored relevant data in a table
method2 - is almost the same as method1, except it accesses a different URL and so pulls the data from the page in a different way, way essentially it uses CURL to get the HTML contents of a URL and pass it to SimpleHTMLDom
method3 - When executed calls method1, then method2
The problem is, if I run method1 and method2 individually, they work fine. But if I try to call method3, then it executes method1 fine, it executes method2, but the SimpleHTMLDom object is empty so the method doesn't work.
There are no error messages.
If I modify method 3 so that it calls method2 then method1 (reserve order), then it's always the 2nd method to be called that doesn't work.
Within in method I'm clearing the SimpleHTMLDom when I'm finished.
Before passing the HTML to the SimpleHTMLDom object, I've tried outputting the HTML provided by CURL, and it's fine.
Does anyone have any ideas why this might be happening?