1

So the background is I want to use PHP to search the DOM from a webpage, in this instance https://www.royalcaribbean.com/aus/en/booking/landing?packageCode=QN17T030&sailDate=2023-04-12&shipCode=QN&destinationCode=TPACI&selectedCurrencyCode=AUD&country=AUS so that I can track price changes and receive alerts when the price changes.

The issue is that this page is loaded via JavaScript, so the html is very short as a loading screen, then AJAX loads the page. Of course PHP won't process the JavaScript, so I was wondering if there was any service (either free public service or something I would need to host on headless Linux) that would take variables of the full link (with its own variables embedded), and a max timeout and would then wait until all JavaScript is run or it reaches the max timeout. It would then serve the processed html (so basically if you go to that page in chrome, the html you see when you "inspect" once loaded, not the one when you view page source).

This way in PHP I could get a detail from a page that is fully loaded via JavaScript.

1 Answer 1

0

Playwright

Yes, you can use Playwright or some similar browser automation library. These run headless versions of the browser that can be controlled programmatically. You would therefore navigate to the desired page, and wait for the JS DOM ready event or some timeout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.