title: Scraping a dynamically loading website with php curl
body: <p>I am new to scraping and have scrapped two websites formally. But the problem appeared to me when I tried to scrape dynamic loading websites. When the website is rendered with JavaScript, I am unable to scrape the contents of the website then. </p>
  
  <p>Is there any way I can scrape the contents of that website using <code>php curl</code> or any other client related to <code>PHP</code>?</p>
  
  <p>This is what I have done so far :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$link = "https://www.glassdoor.com/Job/jobs.htm?suggestCount=0&amp;suggestChosen=false&amp;clickSource=searchBtn&amp;typedKeyword=android+developer&amp;sc.keyword=android+developer&amp;locT=N&amp;locId=192&amp;jobType=";
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch,CURLOPT_URL,$link);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13");
  $data = curl_exec($ch);
  
  
  $document = new DOMdocument();
  libxml_use_internal_errors(true);
  $document-&gt;loadHTML($data);
  $elements = $document-&gt;getElementsByTagName("div");
  
  foreach($elements as $element){
     echo $element-&gt;nodeValue."&lt;br&gt;";;
  }</code></pre>
  </div>
  </div>
  </p>