title: get html page after script execution via php
body: <p>I did a lot of search... tried some methods..
  There is  <a href="http://sosyal.hurriyet.com.tr/yazar/niobe_141/seni-unutmuyoruz-pasam_40011882" rel="nofollow noreferrer">webpage</a> that html contents come after script execution.</p>
  <p>I used phantomJS with different method.</p>
  <p>1-) <em><strong>Checking with document.ready</strong></em></p>
  <pre><code>var page = require('webpage').create();
  console.log('The default user agent is ' + page.settings.userAgent);
  page.settings.userAgent = 'SpecialAgent';
  page.open('http://sosyal.hurriyet.com.tr/yazar/niobe_141/seni-unutmuyoruz-pasam_40011882', function(status) {
   function checkReadyState() {
          setTimeout(function () {
              var readyState = page.evaluate(function () {
                  return document.readyState;
              });
  
              if (&quot;complete&quot; === readyState) {
                  onPageReady();
              } else {
                  checkReadyState();
              }
          });
      }
  
      checkReadyState();
  });
  
  function onPageReady() {
      var htmlContent = page.evaluate(function () {
         return document.body.textContent;
      });
  
      console.log(htmlContent);
  
      phantom.exit();
  }
  </code></pre>
  <p><em>Result:Script not loaded so unloaded html returned..</em></p>
  <p>2-)<em><strong>Setting timeout too long</strong></em></p>
  <pre><code>  page.open(address, function (status) {
      if (status !== 'success') {
          console.log('Unable to load the address!');
          phantom.exit();
      } else {
          window.setTimeout(function () {
              var htmlContent = page.evaluate(function () {
         return document.getElementsByClassName('hsaalicc-text').textContent;
      });
  
      console.log(htmlContent);
  
          }, 1000); // Change timeout as required to allow sufficient time 
      }
  });
  </code></pre>
  <p><em>Result:Script not loaded so unloaded html returned..</em></p>
  <p>So although I'm android developper and have not too much jquery knowlodge looked page code with chrome developper console... And I see all data that should be load is in script with <code>window.articleDetailData</code></p>
  <p><a href="https://i.stack.imgur.com/kDFAM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kDFAM.jpg" alt="enter image description here" /></a>  Moreover I found the function that load data content.</p>
  <pre><code>('#templateArticleDetail').tmpl(data).appendTo('#articleDetailContainer');
  </code></pre>
  <p>There is no time parameter,but in mobile device it takes time. But in code I understand when page loaded it should copy to <em>#articleDetailContainer</em></p>
  <p>So my question
  <em><strong>1-)</strong></em> why document ready and high timeout not return loaded script page with phantomJS
  <em><strong>2-)</strong></em> Is there a way to parse windows.data under script tag??</p>
  <p>If I could not find  any easy way,will use regex to parse script</p>