Run javascript on other site using php
Right now I'm handling a web scraper and I have a small problem. Can I run some javascript code on that page via my scraper? Because some results appear just after the visitor selects a something, I can't get them from there. Here is the example: http://www.finnmatkat.fi/akkilahdot/Post.aspx
This the list for Helsinki, and if I want to select Vasaa I must select it from the drop down menu. So a new list will appear. I don't know how I could get here with my php scraper. I've heard something about the curl library that helps sending variables via GET or POST m开发者_运维技巧ethod. But I don't think if it is the case here. It is also possible to use ajax, but I can't get there. Could anybody give me a clue here?
I think that is really tricky!
Maybe in combination with Selenium some how? However that is not pure PHP anymore.
Another approach would be to build your own PHP Browser. Take V8js a interpret all the stuff by your self. That would be a really cool solution! Okay, maybe a bit too much overhead … ;-)
You can create a request using curl and send the POST parameters. You can monitor the actual request and the headers that are sent and replicate them.
精彩评论