Skip to content
Advertisement

HTML Scraping AJAX Paging Table in PHP

I am trying to scrape a webpage that has an AJAX paging html table. I can get the first page of the table fine but I want to be able to get every single page in the table. Here is an example of an ajax paging table.

This how I am currently scraping the first page:

JavaScript

How can I get all the job postings from this website?

Here is the request from fiddler for the example:

enter image description here

Advertisement

Answer

At the end of the POST content, search for __PreparedPXDO and change the value of __PageNumber:

JavaScript

You can easily create a loop to scrap all available pages, i.e.:

JavaScript

The trick is to make a first post (next page button) using a normal browser and sniff the post content using live http headers for firefox, or similar, and emulate it after using curl.
I’ve tested the code above and I was able to retrieve all job posts on the website.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement