Delay for a simple HTML DOM class

I use the simple html dom class and got it to work on the main pages and can view the information I want. However, when I try to use it on a page that reloads the div using ajax, I cannot make it “wait” before reading the page.

Basically I want it to load the page, and then wait 2 seconds before reading the contents of the page (so that the new div has time to load). Is this possible, or am I trying to use the class incorrectly? I manually enter the URL, so this is not a problem with the link.

Example page : - You can see the loading problem when navigating the pages.

Someone suggested a curl, and I tried this with the same results.

Thanks in advance.

+5
source share
2 answers

You can use the Sleep method ( http://php.net/manual/en/function.sleep.php ) if you just want to delay the execution of the program for a certain amount of time.

0
source

PHP runs on the server. JavaScript (such as AJAX) runs in the browser after the PHP code on the server has finished creating the page. You cannot make a PHP program running on the server, wait for the event that will happen later in the browser.

You need to either load the contents for this div using PHP code, or replace the PHP DOM parsing code with JavaScript code that does the work with the client.

0
source

All Articles