-1

I want to take content of #result from this page,but that div is being loaded after the page is loaded.Now i use this code

$url = 'http://www.fantasynamegenerators.com/alien-names.php#.WaBXGZOg-9Y';
$content = file_get_contents($url);
$first_step = explode( '<div id="result">' , $content );
$second_step = explode("</div>" , $first_step[1] );

To get content of that div,but because that div is getting loaded after the page,it returns the whole page.Now how can i tell php to wait till the page is fully loaded and then take it's content

for rent
  • 105
  • 2
  • 8
  • 1
    Possible duplicate of [Get the content (text) of an URL after Javascript has run with PHP](https://stackoverflow.com/questions/28505501/get-the-content-text-of-an-url-after-javascript-has-run-with-php) – Don't Panic Aug 25 '17 at 17:22

1 Answers1

0

You can't gets result of this part of page that isn't in source code. This div is fulled with data using code written with JavaScript in alienNames.js. By running file_get_contents() you are downloading only HTML structure of give page...

Summarizing, You can't execute js script with php.