0

I am having a trouble with my script. It is supposed to download html from another website and use some specific data and output it to my website. But the website I need to download the html from uses javascript to generate some important data. How can I download the html after javascript has loaded, and use ajax to sent it to php?

Before I was using the file_get_contents, but that only downloads the raw html.

ksbg
  • 3,214
  • 1
  • 22
  • 35
  • 2
    Get the HTML via PHP and then parse it with it, do the animation with jQuery afterward, what have you tried so far ? – Yann Chabot May 15 '15 at 08:25
  • I am totally lost, I haven't no idle how I can do it. I am just asking what would be the best way to handle this. – Aðalsteinn Leifsson May 15 '15 at 08:29
  • You have to think on how to execute your own js code from the web-target domain. I mean, you need to use something like `Windows.Forms.WebBrowser`, which gives you the ability to execute javascript. So, you have to load the page, then execute the same JS than the web executes by ajax by itself. – kosmos May 15 '15 at 09:31

1 Answers1

1

You should take a look to a headless browser, i only know https://github.com/ariya/phantomjs PhantomJs, but i'm sure there are others.

Vindic
  • 627
  • 6
  • 8
  • Is not possible to do this without using PhantomJs – Aðalsteinn Leifsson May 15 '15 at 08:30
  • you can look to this thread there is others solutions :http://stackoverflow.com/questions/6578132/php-headless-browser. But it's better to use well done libraries instead of recreating the wheel. – Vindic May 15 '15 at 08:57