Scrape and Extract data from https://chenmed.wd1.myworkdayjobs.com/en-US/jencare/ when it is not visible in the 'Source Code' of the webpage

I am trying to write an automated PHP script to scrape and extract all 'Job Titles' (Primary Care Physician - Tidewater Market, Primary Care Physician - Richmond Market etc.) from URL

However, this does not seem to be straightforward because the required data is not directly visible in the source code of the webpage. I also tried inspecting 'Developer Tools->Network' of different browsers, however could not locate the source of the data.

Any help would be highly appreciated.

Thanks & Regards!

2

1 Answer

Looking at the requests made by the website one notices an XHR request that contains the data you care about:

enter image description here

However visiting that URL in a browser gives the same result as navigating to . Investigating further by looking at the request headers

enter image description here

one notices the Accept:application/json,application/xml (which signifies that the client expect a json or xml document). Indeed it turns out to be true that requesting with this additional header returns the desired data:

>>> import urllib.request
>>> req = urllib.request.Request(')
>>> req.add_header('Accept', 'application/json,application/xml')
>>> urllib.request.urlopen(req).read().decode('utf-8').find('Primary Care Physician ') > 0
True

Therefore in PHP you probably want to do the following steps:

  1. Request ttps:// with the additional header Accept:application/json,application/xml (see e.g. How do I send a GET request with a header from PHP?)
  2. Parse the returned JSON (e.g. using )
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like