0

i am trying to scrape this page . I want to get statistics part of image. when you will click on "Info Button " , then you can see it's information and all stuff. Statistic part is generate dynamically . i have got all static part but i am not able to get dynamic part. suggestions or code will be very helpful.

Here is my code to get static content:

  $data = file_get_contents('https://www.pexels.com/photo/person-in-front-of-laptop-on-brown-wooden-table-2115217/');
  print_r($data) 

NOTE : They provide API service as well but as much i have read them they are not allowing access to image Statistics part. so what i am planing is to .

  1. Call API and get Search result.
  2. Get all Images URL from result and scrape statistic part from there .
  • Most dynamic parts of website are loaded over XHR. So the data is fetched from another URL. To get this URL you can use for example the Developer Console in Google Chome. Read here how: https://stackoverflow.com/a/3019085/3178126. Maybe the URL with the information you need will popup there. – Jan Doornbos Jul 01 '19 at 14:17

1 Answers1

0

When you click the Info button new ajax call occurs.

You can see that in dev tools (inspect) -> network tab

And this is the requested url: https://www.pexels.com/medium/below-the-fold-photo-stats/2115217/

Horuth
  • 143
  • 8
  • hy thank you very much . i got it. i have been struggling for the last 5 hours that how can i parse that html content. can you please help me to find "number of time download " from that html . Thanks . here is my code so far : `$html = new simple_html_dom(); $html->load_file('https://www.pexels.com/medium/below-the-fold-photo-stats/'.$id.'/'); //$id is the result of ids from API $result1 = $html->find('div.photo-page__info__statistics__view-avatar-container__icons__icon__text'); print_r($html);` – Awais Arshad Jul 01 '19 at 22:18